Pages

How to print 5 numbers using while loop

//How to print 5 numbers using while loop.


#include<stdio.h>
#include<conio.h>


void main()
{
  int i=0;
  clrscr();
  printf("Print 5 numbers using while:\n");
  while(i<5)
  {
   printf("%d\n",i);
   i++;
  }
  getch();
}

Output:

Print 5 numbers using while:
0
1
2
3
4

No comments:

Post a Comment