Showing posts with label one to ten print using for loop. Show all posts
Showing posts with label one to ten print using for loop. Show all posts

Sunday, 28 August 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