answer.
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]
2 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]2 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]2 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!"
Guest1 year 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
While creating an animation, Gina has prepared a document stating the purpose and type of audience for the animation. What has
nekit [7.7K]

Answer:

Flash document

Explanation:

While creating an animation, we need to find out the purpose and the type of the audience, the file size and various other features of the animation. And all these details are being mentioned in one document, and we know that as the flash document. The purpose and the target audience both are being mentioned in the flash document. And this flash document is being used as a reference while developing an animation. The purpose and target audience are important factors while designing an animation.

4 0
2 years ago
Which of the following commands uses correct syntax for matching the patterns bunk or bank at the end of a line of text?
Alika [10]

Answer:

a. grep 'b[au]nk$' myLine

Explanation:

grep is a command used for searching a specified pattern in a given text.

Our goal is to match the character sequence - bank or bunk at the end of line in a  given line referenced by myLine.

The regular expression for the specified match criterion is:

b[au]nk$

The second character can be either a or u.

$ indicates match at end of line.

So the overall grep command is :

grep 'b[au]nk$' myLine

8 0
1 year ago
You are given an array x of string elements along with an int variable n that contains the number of elements in the array. You
Slav-nsk [51]

Answer:

The code to this question can be given as:

Code:

int i,j,count_previous=0,count_next=0; //define variable

for (j=0; j<n; j++) //loop for array

{

if (x[0]==x[j]) //check condition

{

count_previous++; //increment value by 1.

}

}

for (i=0; i<n; i++) //loop

{

for (j=0; j<n; j++)

{

if (x[i]==x[j]) //check condition

{

count_next++; //increment value by 1.

}

}

if (count_previous>count_next) //check condition

{

mode=x[i-1];

}

else

{

mode=x[i];

count_previous=count_next; //change value.

count_next= 0 ; //assign value.

}

}

Explanation:

In the question it is define that x is array of the string elements that is already define in the question so the code for perform operation in the array is given above. In the code firstly we define the variable that is i, j, count_previous, count_next. The variable i,j is used in the loop and variable count_previous and count_next we assign value 0 that is used for check the values of array. Then we define the for loop in this loop we use conditional statement in the if block we check that array of zero element is equal to array of j value then the count_previous is increase by 1. Then we use nested loop It is also known as loop in a loop. In this first loop is used for array and the second loop is used for check array element.In this we use the condition that if array x of i value is equal to array x of j then count_next will increment by 1.Then we use another condition that is if count_previous is greater then count_next then mode of x is decrement by 1. else mode equal to array and count_previous holds the value of count_next and count_next is equal to 0.

8 0
2 years ago
What data unit is encapsulated inside a packet?<br> frame<br> datagram<br> segment<br> session
AVprozaik [17]
The answer is frame
8 0
2 years ago
Read 2 more answers
You buy a $3,500 car and finance it through the car dealer. the contract says if you are two months delinquent with your payment
photoshop1234 [79]
The car owner acquired his car because the car dealer offers him a financing credit services. It is part of the contract that the car owner should pay in monthly basis. It is a fact and part of the contract also that once the car owner failed to pay 2 months of his contribution, the car dealer will get his car back.
6 0
2 years ago
Other questions:
  • In 2–3 sentences, describe how you would change the background of a group of cell
    6·2 answers
  • Any software or program that comes in many forms and is designed to disrupt the normal operation of a computer by allowing an un
    13·1 answer
  • Monica needs to work on a document where she has to highlight topics in bold and add emphasis to some words in a paragraph using
    9·1 answer
  • Which feature of Badoo helped members make their profile more prominent?
    14·1 answer
  • Which perspective is usually used in process simulations?
    6·1 answer
  • Which type of word processing programs enables us to include illustrations within the program?
    6·1 answer
  • A company with a large number of hosts creates three subdomains under a main domain. For easier management of the host records,
    11·1 answer
  • Write a program that calculates taxi fare at a rate of $1.50 per mile. Your pro-gram should interact with the user in this manne
    12·1 answer
  • Which of the following statements is true regarding input and output?
    12·2 answers
  • Which characteristic of Cloud computing allows data centers to better manage hard drive failures and allocate computing resource
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!