Ask Question
17 September, 16:43

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. 17 September, 17:04
    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. 17 September, 17:09
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers