An algorithm to print first 10 natural number using while loop.

1) START

2) Initialize loop counter i=1

3) Check is i<=10 if TRUE then continue ELSE Goto Step 7

4) Print Value of i

5) increment value of i by 1 i.e i++

6) GOTO Step 3

7) END

Flowchart to print first 10 natural number using while loop.

Flowchart to print series form 1 to 10
Flowchart to print series form 1 to 10

C-Code to print first 10 natural number using while loop.

#include<stdio.h>
void main()
  {
int i;
i=1;
while(i<=10)
{
printf("\n %d",i);
i=i+1;
}
   }


C program to print first 10 natural number using do…while loop.

#include<stdio.h>
void main()
{
int i;
i=1;
do
    {
    printf("\n %d",i);
    i=i+1;
   }while(i<=10);
}

Write a C program to print first 10 natural number using for loop.

#include<stdio.h>
void main()
{
int i;
for(i=1;i<=10;i++)
  {
   printf("\n %d",i);
  }
}