Header Ads Widget

Write a program to print first 10 natural numbers in C++

 

 Write a program to print first 10 natural numbers in C++

Write a program in c to print the first 10 natural number . Natural number are starting from example : 1 ,2 , 3 ..........

Sample output

The first 10 Natural Numbers are: 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10

 Write a program to print first 10 natural numbers in C++

The objective of the code is to print the first 10 natural numbers .

Code(C++):-

#include <iostream>
using namespace std;
int main()
{
       int i;
cout<<"The first 10 Natural Numbers are: \n";
for (i=1;i<=10;i++)
{
cout<<i<<endl;
}
return(0);
}

Output:-

The first 10 Natural Numbers are:
1
2
3
4
5
6
7
8
9
10

       


Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments