Answer:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int firstNumber = input.nextInt();
System.out.println("Ready!");
for (int i = firstNumber; i >= 1; i--) {
System.out.println(i);
}
System.out.println("Go!");
}
}
Step-by-step explanation:
- We import the Scanner class to get input from the user.
- We declare a Scanner object called input.
- We use input.nextInt() to read the first number input by the user and assign it to the variable firstNumber.
- We print "Ready!" using System.out.println().
- We use a for loop that starts from firstNumber and decrements by 1 until it reaches 1.
- Inside the for loop, we print each number using System.out.println().
- After the for loop, we print "Go!" using System.out.println().