Q:

Java program to print numbers from 1 to 10 using while loop

0

Java program to print numbers from 1 to 10 using while loop

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program to print the number from 1 to 10 using while loop in java

package IncludeHelp;

public class Print_1_To_10_UsingWhile 
{
	public static void main(String args[])
	{
		//loop counter initialisation
		int i=1;

		//print statement
		System.out.println("Output is : ");

		//loop to print 1 to 10.
		while(i<=10)	
		{
			System.out.println(i);
			i++;
		}
	}
}

Output

Output is : 
1
2
3
4
5
6
7
8
9
10

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now