Ask Question
21 January, 00:20

Write code that prints: Ready! firstNumber ... 2 1 Run! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: firstNumber = 3 outputs:

+5
Answers (1)
  1. 21 January, 01:29
    0
    Complete Question:

    Write code that prints: Ready! userNum ... 2 1 Blastoff! 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 Blastoff!

    Answer:

    public class TestClock {

    public static void main (String[] args) {

    int userNum = 3;

    System. out. print ("Ready! "+userNum+" ");

    for (int i=userNum; i>1; i--) {

    userNum--;

    System. out. print (userNum+" ");

    }

    System. out. println ("Blasoff!");

    }

    }

    Explanation:

    Create and initialize userNum Use System. out. print to print the sequence ("Ready! "+userNum+" ") on same line use for statement with this condition for (int i=userNum; i>1; i--) decremeent userNum by 1 after each loop iteration and print userNum on same line outside the for loop print "Blasoff!"
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write code that prints: Ready! firstNumber ... 2 1 Run! Your code should contain a for loop. Print a newline after each number and after ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers