Select The Correct If Statement To Be Filled In The Following C #98
Select the correct 'if statement' to be filled in the following C# code?</p> <pre><code class="language-csharp" line="1"> static void Main(string[] args) { int []num = {50, 65, 56, 88, 43, 52}; int even = 0, odd = 0; for (int i = 0 ;i < num.Length ;i++) { /*___________________________*/ } Console.WriteLine("Even Numbers:" +even); Console.WriteLine("Odd Numbers:" +odd); Console.ReadLine(); } </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 - IF Statements - Quiz No.1.
Select the correct 'if statement' to be filled in the following C# code?
static void Main(string[] args) { int []num = {50, 65, 56, 88, 43, 52}; int even = 0, odd = 0; for (int i = 0 ;i < num.Length ;i++) { /*___________________________*/ } Console.WriteLine("Even Numbers:" +even); Console.WriteLine("Odd Numbers:" +odd); Console.ReadLine(); }
if ((num % 2) == 0) { even += 1; } else { odd += 1; }
if((num * i) == 0) { even += 1; } else { odd += 1; }
if(num[i] % 2 == 0) { even += 1; } else { odd += 1; }
if(num[i] % 2 = 0) { even += 1; } else { odd += 1; }