0

CAN someone tell me what's wrong with this code and what's the output?!?

#include <stdio.h> main() { int x; for (x=5;x<=10;x++) { printf ("%d",x); if (x==6); break; } }

14th Mar 2020, 1:16 PM
Siyam
Siyam - avatar
7 Respostas
+ 3
#include <stdio.h> int main() { int x; for (x=5;x<=10;x++) { printf ("%d",x); if (x==6) break; } return 0; }run this
14th Mar 2020, 5:09 PM
Shailja Khare
+ 5
#include <stdio.h> int main() { //CAN someone tell me what's wrong with this code and what's the output?!? //#include <studi.h> //main(){ int x; for (x=5;x<=10;x++){ //for printf ("%d",x); if (x==6); break; } // for ends return 0; } edit :Siyam run this in code- playground and compare with your code snippet
14th Mar 2020, 1:20 PM
Daljeet Singh
Daljeet Singh - avatar
+ 3
Actually there is an ";" just after if statement. So the loop breaks on its first iteration
14th Mar 2020, 1:45 PM
Arsenic
Arsenic - avatar
+ 2
Spelling of <stdio.h> is wrong here👇 https://code.sololearn.com/cbjQzzeYEM8K/?ref=app
14th Mar 2020, 1:38 PM
Arsenic
Arsenic - avatar
+ 2
Now check it should work now
14th Mar 2020, 1:45 PM
Arsenic
Arsenic - avatar
+ 1
Still got no output ,showing errors
14th Mar 2020, 1:43 PM
Siyam
Siyam - avatar
+ 1
Yah got it
14th Mar 2020, 1:45 PM
Siyam
Siyam - avatar