Write a loop that simulates a missile launch countdown. Assume an - ProProfs Discuss
Topics
Products
Follow Us:

Write a loop that simulates a missile launch countdown. Assume an integer variable called start contains the starting countdown value. For example,  if start equals15, your loop will print: 15.14.13.12.11.10.9.8.7.6.5.4.3.2.1.Blast-off!! You can assume start is positive. Make sure "Blast-off!!" is followed by a new line.For extra credit, "Ignition!!" along with the 3. You do not have to wait one second between numbers.




This question is part of AP Computer Science Loops Test
Asked by KretschK, Last updated: Mar 19, 2020

+ Answer
Request

2 Answers

John Adney

John Adney

Answered Oct 25, 2017


public class blastOff {

public static void main(String[] args)
{
for( int x = 15; x >= 0; x--)
{
for( int s = 16; s <= x; s--)
{
System.out.print(x-1);
}
System.out.println( x + ". ");
}
System.out.println("Blast off!");
}
}

 

KretschK

KretschK

Answered Aug 26, 2017

Int i for (i = start; i > 0; --i) { System.out.print(i + ...); if (i == 3) { System.out.print(Ignition!!...); } } System.out.println(Blast-off!!);
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.