What will be printed when the following code is executed? #include int main() { inti=0; for(;i<=9;) { i++; printf("%d",i); } return 0; }
Answers
Answered by
1
Output
0123456789
Hope it helps :)
Answered by
0
Output of the above program is Syntax error:
Explanation:
- The above program gives an error because it does not have the header file.
- The header file syntax is not correct, so it will give the syntax error, but when the user writes as "#include<stdio.h>" on the place of "include", then the above program will be executed correctly.
- Then the above program gives the output as "123456789", it is because the code holds a one for loop which executes for the value of 1 to 9, and the value of i variable will be printed. so the value 1 to 9 will be printed.
- If any for loop holds the two semicolons like "for(;;)", then it will be executed and the condition will be also written in the for-loop. The initialization operation and the increment operation is also done on the program. Hence the for loop executes correctly and gives the output as "123456789".
Learn More :
- C-program : https://brainly.in/question/637147
Similar questions