Do while Loop in C


Unlike for and while loops, which test the loop condition at the top of the loop, the do...while loop in C programming checks its condition at the bottom of the loop.

A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one time.

Source Code

//Do While
/*
 
do
{
    -----
    -----
}while(condition);
 
*/
#include<stdio.h>
int main()
{
    int i=0,n;
    printf("\nEnter The Limit : ");
    scanf("%d",&n);
    do
    {
       printf("\n%d",i);
       i+=2; //i=i+2
    }while(i<=n);
    return 0;
}
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes