Ad

Chapter - 4: The Loop Control Structure

Which of the following statements are true for the following program? [Note: The program have a printing mistake that i is not defined, so it is assumed that i is defined in the program]


Ad
D
Sections
8
Exercises
#include<stdio.h>
int main()
{
	int x = 10, y = 100 % 90, i;
	for(i = 1; i <= 10; i++);
	if(x != y);
		printf("x = %d y = %d\n", x, y);
	return 0;
}

1. The printf() function is called 10 times.

2. The program will produce the output x = 10 y = 10.

3. The ; after the if (x != y) would NOT produce an error.

4. The program will not produce any output.

5. The printf() function is called infinite times.


Ans: Following statements are true for the above program.

2. The program will produce the output x = 10 y = 10.

3. The ; after the if (x != y) would NOT produce an error.

Ad

© 2024 Garbage Valuegarbage value logo