Solve this java problem?? Write code that prints: Ready! firstNumber … 2 1 Blastoff! Your code should contain a f
Hi! Can everyone help me solve this java problem?
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:
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!
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.