- 1
why error happen in this program?
#include<iostream> //#include<conio.h> using namespace std; int main() { int x ; for ( x = 1; x <= 10; x++); { if(x==5) break; cout<< x << " " ; } cout<< endl; return 0; }
4 Respuestas
+ 4
You got a semicolon after your loop-definition, so it has no body...
+ 2
Thanks
0
Remove the semicolon comes last of the ' for ' statement. So use
for (x = 1; x <= 10; x++)
//Not like this for (x = 1; x <= 10; x++);
0
very simple code
Remove the semicolon comes last of the ' for ' statement. So use
for (x = 1; x <= 10; x++)
//Not like this for (x = 1; x <= 10; x++);