Write a program to print the number from 1 to 10(Using For Loop) :-


//Print Numbers From 1 To 10 Using Loop

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();

printf("\n"); //for new line

/*  For loop
(initialize; condition ; increment) */

for(n=1;n<=10;n++)
{
printf(" %d",n);
}

getch();
}

Output:


1 2 3 4 5 6 7 8 9 10

			

Previous Next


Note:- If you use Online Compiler, please remove clrscr(); tag.