Print first 10 Natural Numbers

IIIT - N Software Geek. Startup Enthusiast. Build for the Future.
Explanation :
Natural Numbers: Natural numbers are those numbers used for counting and ordering.
Step 1: To find the natural number we are going to use the for loop to print the first 10 numbers.
Step 2: we have taken the variable i=1 which will iterate from value 1 till condition, i<=10 which includes checking condition 10 as well.
Step 3: if the condition is true we need to print the i value.
Java Code :
public class Main{
public static void main(String[] args){
for(int i = 1; i<=10;i++){
System.out.println(i);
}
}
}

Python code:
#method - 1
for i in range(1,11):
print(i)
#method - 2
i = 1
while (i<=10):
print(i)
i = i+1

C++ Code:
#include<iostream>
using namespace std;
int main(){
for(int i=1;i<=10;i++){
cout<<i<<endl;
}
}




