Ask Question
30 August, 17:03

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

+2
Answers (2)
  1. 30 August, 19:05
    0
    import java. util. Scanner;

    public class BlastOff {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. print ("Enter Count Down Number: ");

    int countNum = in. nextInt ();

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

    for (int i = countNum; i>0; i--) {

    System. out. println (i);

    }

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

    }

    }

    Explanation:

    Using Java programming language:

    Prompt and receive count down number from the user using the scanner class Print the string Ready! System. out. println ("Ready!"); Using a for loop Output the numbers from the variable countNum down to 1 Outside of the for loop print Blastoff! System. out. println ("Blastoff!"); All outputs are on seperate lines by using. println ()
  2. 30 August, 19:40
    0
    C# code:

    #include

    / / start main function

    int main ()

    {

    / / declare the required variables

    int userNum = 0;

    int i = 0;

    / / set userNum to 3

    userNum = 3;

    / / print the 'Ready!'

    printf ("Ready!");

    / / print the new line

    printf ("/n");

    / / use the for-loop to print userNum ... 2 1

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

    {

    / / print current value of i

    printf ("%d", i);

    / / print the new line

    printf ("/n");

    } / / end for-loop

    / / print the 'Blastoff!'

    printf ("Blastoff!");

    / / print the new line

    printf ("/n");

    / / return from the program

    return 0;

    } / / end of main function
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write code that prints: Ready! countNum ... 2 1 Blastoff! 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