Computer Science, asked by nxchimkhwen, 2 months ago

Write a program to print numbers less than 50 using while loop.

Answers

Answered by mehakdeepsingh044
1

Answer:

To print the numbers from 1 to 10,

We will declare a variable for loop counter (number).

We will check the condition whether loop counter is less than or equal to 10, if condition is true numbers will be printed.

If condition is false – loop will be terminated.

Answered by Anonymous
0

I have written the program in java below:

public class Print{

public static void main(String args[]){

int no = 1;

System.out.println("The numbers from 1 to 50 are:");

while( no<=50){

System.out.println(no);

no++;

}

}

}

Similar questions