Java program to print the number entered by the user using for loop

Java program to print the number entered by the user using for loop. This is a Java program that uses the For Loop to display numbers from 1 to 10.  We use a For Loop to set a variable to 1 and increment it by 1 each time until we reach 10. When variable 11 is reached, the loop ends.The Java Program to Display Numbers from 1 to 10 Using For Loop source code is available here.

public class Main
{
public static void main(String[] args)
{
for(int i = 1; i <= 10; i++)
{
System.out.println(i);
}
}
}

1
2
3
4
5
6
7
8
9
10