In this tutorial you will learn about the C Program To Print First 10 Natural Numbers and its application with practical example.
In this tutorial, we will learn to create a C program that will display First 10 Natural numbers using C programming.
Prerequisites
Before starting with this tutorial we assume that you are best aware of the following C programming topics:
- C Operators
- C loop statements
What Is Natural Number?
Example
C program to display first 10 natural numbers.
In this program we will print starting 10 natural integer values. Using For loop.
C Program to Print Natural Numbers from 1 to 10 using for Loop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include<stdio.h> int main() { int j; //declaring variable printf(“First 10 Natural numbers are\n"); for(j=1;j<=10;j++) // loop for 10 natural values { printf("%d \t",j); // printing required output. } return(0); } |
output
In the above program, we have first declared and initialized a set variables required in the program.
- j= for iteration of loop.
In this program we will need only one variable for traversing first 10 natural number.
Within this Program to display 1 to 10 natural number.
- The first we will create an integer variable j.
- then, we use For Loop to iterate between j=1 to j<=10 and
- Within the For loop, we print the value of j .
- In our C Programming example, shows value from 1- 10.
that’s all fro this post thank-you.