Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Question

Given in the following program:

	main()
	{
		int x=49;
		for (;x;)
		x--;
		printf("%d\n",x);
	}
	

What will be the output of the program?

A 49
B 0
C -49
D none of these
Answer & Explanation
Option: [B]

For all non-zero values of x the for will execute. x is decremented from 49 to 0. Hence 0 is printed in the screen.

Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Random GK Questions

Assam Direct Recruitment Test Series

Computer Science Topics