The program in C++ to Find the First 10 natural numbers is given below:
#include <iostream>
using namespace std;
int main() {
cout<<"Hello Codeauri Family, Here are the first 10 natural numbers :\n";
// Output the first 10 natural numbers
for (int i = 1; i <= 10; i++) {
cout << i << " ";
}
return 0;
}
Output:
Hello Codeauri Family, Here are the first 10 natural numbers :
1 2 3 4 5 6 7 8 9 10
Pro-Tips💡
This program uses a for loop to iterate through the values of i from 1 to 10, and prints each value of i.
Since the first 10 natural numbers are the numbers from 1 to 10, the program will output 1 2 3 4 5 6 7 8 9 10,
which are the first 10 natural numbers.
Learn C-Sharp ↗
C-sharp covers every topic to learn about C-Sharp thoroughly.
Learn C Programming ↗
C-Programming covers every topic to learn about C-Sharp thoroughly.
Learn C++ Programming↗
C++ covers every topic to learn about C-Sharp thoroughly.