Ask Question
12 May, 13:38

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!

+3
Answers (2)
  1. 12 May, 14:02
    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. 12 May, 17:31
    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?
Get 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 & 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