Print number using for loop in C Programming

  • Tech Area
  • May 9, 2024



In this tutorial, We will see how to print numbers using for loop in C programming language.

Program to print numbers

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

Output

1
2
3
4
5
6
7
8
9
10

In this program, Intialize for loop starting from 1 to 10. Values are stored in variable a.

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

The printf() function is used to display the numbers.


Subscribe us via Email

Join 10,000+ subscriber

Subscribe on YouTube