+ 5

What is the output of c from the below program?

for(c=10;c<10;c++){} cout<<c

5th Feb 2017, 8:20 AM
Hariprasath R
3 Answers
+ 1
10, for the simple fact that the for loop doesn't execute at all since c is not actually less than 10 in the first place. Hence c is equal to the initial value, 10.
5th Feb 2017, 8:40 AM
blackcat1111
blackcat1111 - avatar
+ 1
obviously 10.... because 10<10 is false so it comes out of loop and prints 10 .... For better understanding of for loop click here https://www.learnbix.com/c-statements/for-loop
6th Feb 2017, 4:56 AM
Chaitanya
Chaitanya - avatar