While loop in c

while can be used as a infinite loop too ,the while loop executes the statements if the test condition is true. This process continues until the test condition fails(false).lest look into the while loop syntax


while(test condition)

here, as long as the condition is satisfied the statements between the braces are executed, let’s look into a program for factorial and flow chart of while loop. We can use increment and decrement statements inside the while loop


while in c
void main()
int number;
long long factorial;
printf("Enter an integer: ");
factorial = 1;
while (number > 0)
factorial *= number; // factorial = factorial*number;
printf("Factorial= %lld", factorial);


Enter an integer: 5
Factorial= 120