For The Incomplete C Program Below Which Of The C Code Fragment #142
For the incomplete C# program below, which of the C# code fragment will not result in an infinite loop?</p> <pre><code class="language-csharp" line="1"> static void Main(string[] args) { int i = 1234 ,j = 0; /*ADD CODE HERE */ Console.WriteLine(j); } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs108 CSharp. It can also be found in gs gs108 Looping Statements - Do While Loop Statements - Quiz No.1.
For the incomplete C# program below, which of the C# code fragment will not result in an infinite loop?
static void Main(string[] args) { int i = 1234 ,j = 0; /*ADD CODE HERE */ Console.WriteLine(j); }
do { j = j + (i % 10); }while ((i = i / 10)!= 0);
do { j = j + (i % 10); }while ((i / 10)!= 0);
do { j = j + (i % 10); }while ((i % 10)!= 0);
do { j = j + (i % 10); }while ((i/10 == 0)!= 0);