C Program To Print Numbers Upto 5 Using Do-While Loop

How to write a C Program to print numbers upto 5 using do-while loop in C Programming language.

Solution -

/*Progam to print numbers upto 5 using do-while loop*/
#include<stdio.h>
void main()
{
     int num=1;    //initialisation phase
     do
     {
        printf("\t%d",num);
        num=num+1;    //increment phase
     }
     while(num<5);    //condition phase
}

Tags: C Program to print numbers upto 5 using do-while loop, c program to print n natural numbers using while loop, c program to print first 10 natural numbers, sum of first 10 natural numbers in c using while loop, c program to print 1 to 10 numbers using while loop, program to find sum of n natural numbers in c, c program to print natural numbers from 1 to 10 in reverse order, write a program to print first 10 natural numbers in java, do while loop in c programming example.


Learn More :