Answer to Question #277942 in Java | JSP | JSF for Adeng

Question #277942

Using WHILE LOOP statement

Write a Program that will ask the user to accept an

integer input and outputs message below:


Print Numbers Descending (from 1000)


Enter the number that you want to print:

Number of iterations:


1
Expert's answer
2021-12-10T00:38:27-0500
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Print Numbers Descending (from 1000)");
        System.out.println("Enter the number that you want to print:");
        int number = in.nextInt();
        System.out.println("Number of iterations:");
        int iterations = in.nextInt();
        while (iterations > 0) {
            System.out.println(number);
            iterations--;
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS