Question: Show the output for the following code blocks: int x=3, y=4, z=5; 1. if (x==3) printf (Hi); 2. if (x==4) printf(Hi); else printf(Bye); 3. if

Show the output for the following code blocks: int x=3, y=4, z=5;

1. if (x==3) printf (Hi);

2. if (x==4) printf(Hi); else printf(Bye);

3. if (x <= z) { printf(Hi); printf(Hows it going?); } else { printf(Bye); printf(See you later!); }

4. if (x == 0) printf(x is equal to 0); else if (x == 1) printf(x is equal to 1); else if (x == 2) printf(x is equal to 2); else printf(x is not equal to 0, 1, or 2); double x = 75.0, y=85.0, z=95.0;

5. Write code that uses an if-statement to test if x is less than y, if it is, print a message x is less than y.

6. Write code that uses an if-else statement to test if x is not equal to z, if so, print 2 messages: x is not equal to z and maybe x is equal to y?, else, print x is not equal to z.

7. Write code that uses an if-else-if statement to test if z is less than 80.0, if so, print 2 messages: z is less than 80.0 and good job, else test if z is less than 90.0, if so, print 2 messages: z is less than 90.0 and good job, else test if z is less than 100.0, if so, print 2 messages: z is less than 100.0 and good job, else print a message z is greater than or equal to 100.

Show the output for the following code block: 8. int i = 0, stopValue = 5; while (i < stopValue) { printf(This is loop number %d, i); i = i + 1; }

9. Write a while loop that will print Hello there! 7 times to the screen:

10. Write a for loop that will print Hello there! 12 times to the screen:

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!