Write a program to print numbers less than 50 using while loop.
Answers
Answered by
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
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
Chemistry,
1 month ago
Math,
1 month ago
Social Sciences,
1 month ago
English,
2 months ago
Math,
9 months ago