+ 1

why it is not show any output when run this program #include<iostream> using namespace std; int main(){ for(;;){ int i=0; if(i==1){ cout<<i; break; } ++i; }

1st Sep 2016, 9:01 AM
Lekhraj Singh
Lekhraj Singh - avatar
2 odpowiedzi
+ 2
you have initialised i=0 and have used "I"=1 c++ is case sensitive
1st Sep 2016, 9:18 AM
Kalai Vanan
Kalai Vanan - avatar
+ 1
'i' is initialised as 0. in the for loop no condition or anything else is given.... that is why value of I is never decreased or increased....that is it cannot be equal to 1 so if statement is also false and it jumps to break hence nothing is output!
2nd Sep 2016, 6:20 PM
Piyush Yadav
Piyush Yadav - avatar