Output_of_C_Program


#1

Please tell the output of the following C program, given that all the required header files are already present in the code.

void main
{
int a;
for(a=9;a!=0;a–)
printf(“Value=%d”, a–);
getch();
}


#2

It is a for loop with a having initial value of 9 and given condition is a!=0 which is initially false,so it enters the loop and prints Value=9 and then decrement the value of a by 1 .
=> a=8;
condition is false,so it prints 8 and so on till a becomes 0;
when a =0, the loop ends and the program terminates.


#3

Value =8 till 0 until loop not fals


#4

Output of the this program is infinity