Write code that prints: Ready! userNum ... 2 1 Start! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: userNum = 3 outputs: Ready! 3 2 1 Start! The code should be in Java.
//java code
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Enter user Number:");
int userNum=input.nextInt();
System.out.print("\nReady!");
for(int i=userNum;i>=1;i--)//for loop to print numbers from
userNum to 1
System.out.print("\n"+i);
System.out.print("\nStart!");
}
}
Get Answers For Free
Most questions answered within 1 hours.