+ 4
What's the output of this code
#include<stdio.h> int main(){ int x; for(x=-1; x<=10; x++){ if(x < 5) continue; else break; printf("c programming");} return 0;}
4 Respostas
+ 5
Oh. Sry i did not checked code clearly.. but mention question clearly..
#include<stdio.h>
int main() {
int x;
for(x=-1; x<=10; x++){
if(x < 5)
continue; //causes loop stop current iteration ,go with next iteration
else
break; //causes loop break
printf("c programming"); //never touched
}
return 0;
}
/*
initially x= -1, so x<=10
and next
x<5 is true, so continue with next iteration
x++ => x=0
x<5 is true, so continue with next iteration
x++ => x=1
x<5 is true, so continue with next iteration
x++ => x=2
x<5 is true, so continue with next iteration
x++ => x=3
x<5 is true, so continue with next iteration
x++ => x=4
x<5 is true, so continue with next iteration
x++ => x=5
x<5 is false, so goes to else and break cause to break the loop. so loop gets terminated here
Till now, and outside of loop, no output statements executed so no output....
edit:
saurav do you trying to get any output?
hope it clears..
+ 1
Jayakrishna🇮🇳 it's showing no output ! Btw basically I want to know how output come
I mean logic behind 🤔it
0
Check in playground....
edit: