Sample program for using for loop in C:
What does this program do? what will be the output?
x = x* i;
printf("result is %d ",x);
This is the code to find factorial of a given number. Output for this program is factorial of 4 , i.e 24.
this code is multiplying all the numbers with 4 and adding. result is 38.
it gives compile time error.
it is an example of infinite loop and crashes the program at run time.
Back To Top