DamnSchool
The while loop is an entry controlled loop statement, means the condition is evaluated first and it is true, then the body of the loop is executed. After executing the body of the loop, the condition is once again evaluated and if it is true, the body is executed once again, the process of repeated execution of the body of the loop continues until the condition finally becomes false and the control is transferred out of the loop.

While-loop

#include<stdio.h>
int main()
{
int i=1, sum=0;
while(i<=10)
{sum=sum+i;
i++;
}
printf("The sum of numbers upto 10 is %d",sum);
}

Run Example >

< Previous Next >

Privacy Policy Terms of Service About
Creative Commons License
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.