0
Int a=0; while(a) {printf("Hii");} What will be the output??
Written in C
9 Answers
+ 3
Ashutosh Modgil , the code gives no output. In this way as follows you can test and play with a code examples. Please change the variable to a = 1 and see what happend after that.
https://code.sololearn.com/ch61OXcU93bd/?ref=app
+ 10
Ashutosh Modgil ,
âȘïžwhy do you don't try to run the code by yourself?
âȘïžyou mentioned that the code is written in c. so what is the reason that some other languages are named in the tags?
+ 3
Don't rely on the compiler to tell you what's wrong. Try to understand the code.
If you do the c basics, you'll understand what the problem is.
+ 1
Sir, actually compiler only pop out errors....it doesnt tell us whats the reason behind that its not executing...am just getting the answers from proffesionals out here on sololearn đ Hope you will understand me, thanks
+ 1
No output
+ 1
Scoozak as the condition of loop is false the loop I'll never be executed so it's not the case of exaggeration of loop
+ 1
The output will be a syntax error. There is no type "Int". You surely meant "int".
But I can bet the compiler would state this upfront. I didn't understand why you didn't inform the compiler errors.
0
Well there is two scenarios going to happen. Your program will be not executed since it is endless loop or in other scenario your computer will freeze trying to print it as much as it can.
0
Be careful with the use of the while loop. You must always guarantee the entry of the loop: int a = 10 and not a = 0; Then you have to guarantee the exit of the loop. while ((a--)> 0) // guarantee the output to a = 0 Finally do loop processing.