What will be the output of the following C# code?
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
Related questions
Question
![What will be the output of the following C# code?
1.
static void Main(string[] args)
2.
{
int i = 2, j
3, k = 4;
3.
4.
switch (i +j
k)
5.
{
6.
case 0: case 2: case 4:
7.
++i;
8.
k +=
j;
9.
break;
10.
case 1: case 3: case 5 :
11.
-i;
12.
k -=
j;
13.
break;
14.
default:
15.
i +=
j;
16.
break;
17.
18.
Console.Writeline(i + "\n" + j + "\n" + k);
Console. ReadLine();
19.
20. }
a) 131
b) 2 34
c) 5 34
d) Compile time error](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ff8b289ff-20e6-4966-bc13-549e59cff2e6%2F38fcf363-1ef8-4b22-baec-230b6ca54aa7%2Fthkfx3_processed.png&w=3840&q=75)
Transcribed Image Text:What will be the output of the following C# code?
1.
static void Main(string[] args)
2.
{
int i = 2, j
3, k = 4;
3.
4.
switch (i +j
k)
5.
{
6.
case 0: case 2: case 4:
7.
++i;
8.
k +=
j;
9.
break;
10.
case 1: case 3: case 5 :
11.
-i;
12.
k -=
j;
13.
break;
14.
default:
15.
i +=
j;
16.
break;
17.
18.
Console.Writeline(i + "\n" + j + "\n" + k);
Console. ReadLine();
19.
20. }
a) 131
b) 2 34
c) 5 34
d) Compile time error
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images

Knowledge Booster
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.Recommended textbooks for you

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning