V Vy Bùi New member Sep 18, 2021 #1 What will be the output of the following C# code? Code: static void Main(string[] args) { int i = 1, j = 1; while (++i <= 10) { j++; } Console.WriteLine(i+ " " +j); Console.ReadLine(); } A. 12 11 B. 10 11 C. 11 10 D. 11 12
What will be the output of the following C# code? Code: static void Main(string[] args) { int i = 1, j = 1; while (++i <= 10) { j++; } Console.WriteLine(i+ " " +j); Console.ReadLine(); } A. 12 11 B. 10 11 C. 11 10 D. 11 12
N Ngô Trường Vủ New member Sep 18, 2021 #2 Answer: c Explanation: As ++i, first increments then execute so, for ++i i is 11 and j++ is first execute then increments. So, j = 10. Output: Code: 11 10. Upvote 0 Downvote
Answer: c Explanation: As ++i, first increments then execute so, for ++i i is 11 and j++ is first execute then increments. So, j = 10. Output: Code: 11 10.