What will be the output of the following C# code? 1. static void Main(string[] args) 2. { int i = 2, k = 3; switch (i - k) 3. 4. 5. { 6. case -1: 7. ++i; 8. ++k; 9. break; 10. case 2: 11. --i; 12. ++k; 13. break; 14. default: 15. i += 3; 16. k += i; 17. break; 18. } Console.Writeline (i + "\n" + k); 19. 20. Console.ReadLine(); 21. ) 2 33 ) 3 2 3 ) 344 I) 5 10 10

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
What will be the output of the following C# code?
1.
static void Main(string[] args)
2.
{
int i = 2, k = 3;
switch (i - k)
3.
4.
5.
{
6.
case -1:
7.
++i;
8.
++k;
9.
break;
10.
case 2:
11.
--i;
12.
++k;
13.
break;
14.
default:
15.
i += 3;
16.
k += i;
17.
break;
18.
}
19.
Console.WriteLine (i + "\n" + k);
20.
Console. ReadLine();
21.
}
a) 233
b) 323
c) 3 44
d) 5 10 10
Transcribed Image Text:What will be the output of the following C# code? 1. static void Main(string[] args) 2. { int i = 2, k = 3; switch (i - k) 3. 4. 5. { 6. case -1: 7. ++i; 8. ++k; 9. break; 10. case 2: 11. --i; 12. ++k; 13. break; 14. default: 15. i += 3; 16. k += i; 17. break; 18. } 19. Console.WriteLine (i + "\n" + k); 20. Console. ReadLine(); 21. } a) 233 b) 323 c) 3 44 d) 5 10 10
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT