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
Leni [432]
3 years ago
12

Write a program that uses while loops to perform the following steps: Step a: Prompt the user to input two integers: firstNum an

d secondNum (firstNum must be less than secondNum). Step b: Output all odd numbers between firstNum and secondNum. Step c: Output the sum of all even numbers between firstNum and secondNum. Step d: Output the numbers and their squares between 1 and 10. Step e: Output the sum of the square of the odd numbers between firstNum and secondNum. Step f: Output all uppercase letters.
Engineering
1 answer:
Elodia [21]3 years ago
8 0

Answer:

#include<iostream>  

using namespace std;  

int main()

{

    int i, sum = 0, sqSum = 0, firstNum = 1, secondNum = 0;

    char ch;

    while (!(firstNum < secondNum))

    {

         cout << "Enter starting number: ";

         cin >> firstNum;

    cout<<"Enter ending number(must be > startingNumber): ";

         cin >> secondNum;

    }

    i = firstNum;

    cout << "The odd numbers between " << firstNum

         << " and " << secondNum << " are:\n";

    while (i <= secondNum)

    {

         if (i % 2 == 0)

             sum = sum + i;

         else

         {

             cout << i << " ";

             sqSum = sqSum + i * i;

         }

         i++;

    }

    cout << "\n\nThe sum of the even numbers is:"

         << sum << endl << endl;

    cout << "The sum of squares the odd numbers is:"

         << sqSum << endl;

    i = 1;

    cout << "\nNumber Square\n";

    while (i <= 10)

    {

         cout << " " << i << "\t " << i * i << endl;

         i++;

    }

    system("pause");

    return 0;

}

You might be interested in
Most of the work that engineers do with fluids occurs in nature. True False
zlopas [31]
True depending the jobs
3 0
3 years ago
A stomp rocket is a toy consisting of a hose connected to a blast pad (i.e., an air bladder) at one end and to a short pipe moun
lesya [120]

Answer:

Explanation:

The detailed steps is as shown in the attachment.

8 0
3 years ago
What is the best engineering job to do? Why?
allochka39001 [22]

Answer:

Any engineering job would be good YOU should be the one choosing which job.

Explanation:

Engineering is a great outlet for the imagination, and the perfect field for independent thinkers.

7 0
2 years ago
Read 2 more answers
Write the implementation (.cpp file) of the Player class from the previous exercise. Again, the class contains:
hoa [83]

Answer:

//Define the header file

#ifndef PLAYER_H

#define PLAYER_H

//header file.

#include <string>

//Use the standard namespace.

using namespace std;

//Define the class Player.

class Player

{

//Declare the required data members.

string name;

int score;

public:

//Declare the required

//member functions.

void setName(string par_name);

void setScore(int par_score);

string getName();

int getScore();    

}

//End the definition

//of the header file.

#endif

Player.cpp:

//Include the "Player.h" header file,

#include "Player.h"

//Define the setName() function.

void Player::setName(string par_name)

{

name = par_name;

}

//Define the setScore() function.

void Player::setScore(int par_score)

{

score = par_score;

}

//Define the getName() function.

string Player::getName()

{

return name;

}

//Define the getScore() function.

int Player::getScore()

{

return score;

}

7 0
3 years ago
A geothermal pump is used to pump brine whose density is 1050 kg/m3 at a rate of 0.3 m3/s from a depth of 200 m. For a pump effi
nasty-shy [4]

Answer:

Input power of the geothermal power will be 686000 J

Explanation:

We have given density of brine \rho =1050kg/m^3

Rate at which brine is pumped V=0.3m^3/sec

So mass of the pumped per second

Mass = volume × density = 1050\times 0.3=315 kg/sec

Acceleration due to gravity g=9.8m/sec^2

Depth h = 200 m

So work done W=mgh=315\times 9.8\times 200=617400J

Efficiency is given \eta =0.9

We have to fond the input power

So input power =\frac{617400}{0.9}=686000J

So input power of the geothermal power will be 686000 J

5 0
3 years ago
Other questions:
  • CNG is a readily available alternative to
    5·1 answer
  • A Canadian visitor says that we have a great day in Chattanooga because it's 30 degrees. What would the temperature be in Farenh
    15·1 answer
  • A parison is extruded from a die with outside diameter = 11.5 mm and inside diameter = 7.5 mm. The observed die swell = 1.25. Th
    8·1 answer
  • What type of drawing would civil engineers use if they needed to show an
    11·1 answer
  • Two loads connected in parallel draw a total of 2.4 kW at 0.8 pf lagging from a 120-V rms, 60-Hz line. One load absorbs 1.5 kW a
    5·1 answer
  • What is the key to being a good engineer?
    15·2 answers
  • Your study space does not need to be quiet as long as you can ignore any noise coming from the space true or false?
    9·2 answers
  • ما جمع كلمة القوة؟help please
    10·1 answer
  • 50 points
    7·1 answer
  • Respond with TRUE if the symbol of the valve shown belows
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!