Posted: November 13th, 2021

For loops – zybooks | Computer Science homework help

 Hi! Can everyone help me solve this java problem? 

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Write code that prints: Ready! firstNumber … 2 1 Blastoff!
Your code should contain a for loop. Print a newline after each number and after each line of text.   

Ex: If the input is:  

3  

The output is:  

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Ready! 

3

2

1

Blastoff!

This is my code: 

import java.util.Scanner;

public class ForLoops {

   public static void main (String [] args) {

      int firstNumber;

      int i;

      Scanner input = new Scanner(System.in);

      firstNumber = input.nextInt();

      System.out.println("Ready!n"+firstNumber);

      for (i=firstNumber;i>1; i--){

           firstNumber--;

           System.out.println(""+firstNumber);

       }

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

   }

}

When running the program, my output only matches the two outputs as shown in the attached picture. The rest do not match. How can my code be the same as the expected output as in the attached image?

Thanks, everyone!

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Open chat
1
Order through WhatsApp!
affordablepaperwritings.com
Hello!
You Can Now Place your Order through WhatsApp

Order your essay today and save 30% with the discount code DISCOUNTS2022