Discussion :: Control Instructions - c#
-
Which of the following code snippets are the correct way to determine whether a is Odd or Even?
-
int a; String res; if (a % 2 == 0) res = "Even"; else res = "Odd";
-
int a; String res; if (a Mod 2 == 0) res = "Even"; else res = "Odd";
-
int a; Console.WriteLine(a Mod 2 == 0 ? "Even": "Odd");
-
int a; String res; a % 2 == 0 ? res = "Even" : res = "Odd"; Console.WriteLine(res);
-
Answer : Option B
Explanation :
No answer description available for this question.
Be The First To Comment