1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Romashka-Z-Leto [24]
3 years ago
13

Write code that prints: Ready! firstNumber ... 2 1 Run! Your code should contain a for loop. Print a newline after each number a

nd after each line of text Ex: firstNumber = 3 outputs:
Computers and Technology
3 answers:
daser333 [38]3 years ago
5 0

Answer:

//This program is written in C++ Programming Language

// Comments are used for explanatory purpose

// Program starts here

#include<iostream>

using namespace std;

int main()

{

// Declare Variable

int firstNumber;

// Accept Input for firstNumber

cin>> firstNumber;

// Print firstNumber

cout<<"firstNumber = "<<firstNumber<<endl;;

//Start Loop

for(int i = firstNumber - 1; firstNumber>0; firstNumber--)

{

// Print iteration value

cout<<firstNumber<<endl;

}

// Print Run! at the end

cout<<"Run!";

return 0;

//End of Program

}

LUCKY_DIMON [66]3 years ago
3 0

Complete Question:

Write code that prints: Ready! userNum ... 2 1 Blastoff! Your code should contain a for loop. Print a newline after each number and after each line of text Ex: userNum = 3 outputs: Ready! 3 2 1 Blastoff!

Answer:

public class TestClock {

   public static void main(String[] args) {

       int userNum= 3;

       System.out.print("Ready! "+userNum+" ");

       for (int i=userNum;i>1; i--){

           userNum--;

           System.out.print(userNum+" ");

       }

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

   }

}

Explanation:

  1. Create and initialize userNum
  2. Use System.out.print to print the sequence ("Ready! "+userNum+" ") on same line
  3. use for statement with this condition for (int i=userNum;i>1; i--) decremeent userNum by 1 after each loop iteration and print userNum on same line
  4. outside the for loop print "Blasoff!"
That one guy3 years ago
0 0

#include <iostream>
using namespace std;

int main() {
int firstNumber;
int i;

cin >> firstNumber;

for(i = firstNumber; i>0; --i) {
if (i == firstNumber && i>0) {
cout << "Ready!" << endl;
cout << firstNumber << endl;
}
else if (i!= firstNumber && i>0){
firstNumber = (firstNumber-1);
cout << firstNumber << endl;
}
}
if (firstNumber<= 0){
cout << "Ready!" << endl;
}
cout << "Run!" << endl;
return 0;
}</iostream>

You might be interested in
Assume that there is a class called BankAccountHolder that represents an individual member of a bank. There is also a BankAccoun
Elina [12.6K]

Answer:

Aggregation

Explanation:

In Java, Aggregation is a relationshipthat exists between two classes that is best described as a "has-a"

7 0
4 years ago
Read 2 more answers
What are the five steps of ethical hacking?
Paraphin [41]

Answer

Explanation:

Hacking is simply gaining access into a computer through weaknesses that were found in the network system.

We have mainly 5 stages In ethical hacking which although must not be followed sequentially but could produce greater results if it was followed.

These stages includes

1. Reconnaissance

2. Scanning

3. Gaining access

4. Maintaining access

5. Covering tracks.

8 0
4 years ago
Write a program that reads in a text file, infile.txt, and prints out all the lines in the file to the screen until it encounter
ivanzaharov [21]

Answer:

Explanation:

f=open("infile.txt","r")

flag=True

while(flag):

s=f.readline().strip()

if(len(s)>=4):

print(s)

else:

flag=False

8 0
3 years ago
A plan to budget time for studying and activities is referred to as a study routine. study habits. study skills. a study schedul
vesna_86 [32]

Answer:

A study routine

Explanation:

6 0
3 years ago
Read 2 more answers
Who is the smartest avenger??? :)
Rom4ik [11]

Answer:

Iron Man

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Can you please answer the questions computer subject
    12·1 answer
  • According to your course, two benefits of a cloud-based system are_ and_
    12·1 answer
  • A binary search can be performed only on ____.
    6·1 answer
  • How could you insert a new row between rows 20 and 21?
    10·2 answers
  • Your browsing the Internet and realize your browser is not responding which of the following will allow you to immediately exit
    14·2 answers
  • Is anyone else recieving a notification from brainly near the search bar about a message and click it and there nothing there???
    8·1 answer
  • 12. How many different documents can<br> you have open at one time?
    8·1 answer
  • The color in a circle is a _____________ data type.
    13·1 answer
  • Need the answer ASAP!!! I’ll mark brainliest if correct
    5·1 answer
  • Python 3.12 LAB: Input and formatted output: Right-facing arrow Given input characters for an arrowhead and arrow body, print a
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!