Ask Question
6 June, 23:16

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. 7 June, 02:12
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers