8.29.2011

Print one to ten using for loop

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

Ans.

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

     Output of above program : 
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10

No comments:

Post a Comment