8.29.2011

Print one to ten program

Q. Write a program to printout one to ten counting using while loop?
Ans.

#include<stdio.h>
#include<conio.h>
int main()
{
 int x=1;
 while(x<=10)
 {
   printf("\n%d",x);
   x++;
 }
 getch();
 return 0;
}

       output of above program : 

  1
  2
  3
  4
  5
  6
  7
  8
  9
  10

No comments:

Post a Comment