What will be the output of the following C code?#include main( ){int i;for (i=0; i<5; i++){int i = 10;printf("%d", i);i++;}return 0;}
By BYJU'S Exam Prep
Updated on: October 17th, 2023
- 10 11 12 13 14
- 10 10 10 10 10
- 0 1 2 3 4
- Compilation error
The output of the following C code #include
#include
main( )
{
int i;
for ( i=0; i<5; i++ ) //this loop runs 5 times
{
int i = 10;// initialised to 10
printf(“%d”, i); // It prints 10
i++;// incremented by 1 but here i is a local variable inside a for loop.[this i values are 0,1,2,3,4]
}
return 0;
}
Output will be 10 10 10 10 10
Summary:-
What will be the output of the following C code?#include main( ){int i;for (i=0; i<5; i++){int i = 10;printf(\%d, i);i++;}return 0;} 10 11 12 13 14, 10 10 10 10 10, 0 1 2 3 4, Compilation error
The output of #include
Related Questions:-