Question: For the following code snippets, write down the expected output by hand first and then verify your results with a program in C. 1. a

For the following code snippets, write down the expected output by hand first and then verify your results with a program in C.

1.

a = 1;

while (a % 7 != 0){

if (a % 2 == 0){

printf("O");

}

if (a == 2)

printf("X");

a = a + 1;

}

printf("a=%d", a);

2.

keep_going = 1;

a = 0

b = 0

while (keep_going){

printf("O");

if (a + b >= 24)

keep_going = 0;

a = a + 3;

b = b + 5;

}

printf("a=%d", a);

printf("b=%d", b);

3.

a = 1;

while (a < 5){

if (a % 2 == 0){

b = 1;

while (b < 3){

printf("X");

b = b + 1;

}

}

printf("O");

a = a + 1;

}

printf("a=%d", a);

printf("b=%d", b);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!