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
The displacement volume of an internal combustion engine is 2.2 liters. The processes within each cylinder of the engine are mod
soldier1979 [14.2K]

Answer:

A) 14.75

B) 3.36Kj

C) 2384.2k

D) 117.6kW

E) 57.69%

Explanation:

Attached is the full solutions.

5 0
4 years ago
10. What does a profile of a river from its headwaters to its mouth typically show?
irina1246 [14]

Answer:

c. an abrupt increase followed by a gradual decrease

Explanation:

At the headwater, the flow gradient starts high but then slowly decreases as the river moves downstream to its mouth.

3 0
3 years ago
Convert the unit Decimeter (dm) into Micrometer (um).
oksian1 [2.3K]

Answer:

86701 Micrometers.

Explanation:

Multiply 0.86701 dm by 100,000 to get 86701 um.

7 0
3 years ago
Two identical billiard balls can move freely on a horizontal table. Ball a has a velocity V0 and hits balls B, which is at rest,
Lyrx [107]

Answer:

Velocity of ball B after impact is 0.6364v_0 and ball A is 0.711v_0

Explanation:

v_0 = Initial velocity of ball A

v_A=v_0\cos45^{\circ}

v_B = Initial velocity of ball B = 0

(v_A)_n' = Final velocity of ball A

v_B' = Final velocity of ball B

e = Coefficient of restitution = 0.8

From the conservation of momentum along the normal we have

mv_A+mv_B=m(v_A)_n'+mv_B'\\\Rightarrow v_0\cos45^{\circ}+0=(v_A)_n'+v_B'\\\Rightarrow (v_A)_n'+v_B'=\dfrac{1}{\sqrt{2}}v_0

Coefficient of restitution is given by

e=\dfrac{v_B'-(v_A)_n'}{v_A-v_B}\\\Rightarrow 0.8=\dfrac{v_B'-(v_A)_n'}{v_0\cos45^{\circ}}\\\Rightarrow v_B'-(v_A)_n'=\dfrac{0.8}{\sqrt{2}}v_0

(v_A)_n'+v_B'=\dfrac{1}{\sqrt{2}}v_0

v_B'-(v_A)_n'=\dfrac{0.8}{\sqrt{2}}v_0

Adding the above two equations we get

2v_B'=\dfrac{1.8}{\sqrt{2}}v_0\\\Rightarrow v_B'=\dfrac{0.9}{\sqrt{2}}v_0

\boldsymbol{\therefore v_B'=0.6364v_0}

(v_A)_n'=\dfrac{1}{\sqrt{2}}v_0-0.6364v_0\\\Rightarrow (v_A)_n'=0.07071v_0

From the conservation of momentum along the plane of contact we have

(v_A)_t'=(v_A)_t=v_0\sin45^{\circ}\\\Rightarrow (v_A)_t'=\dfrac{v_0}{\sqrt{2}}

v_A'=\sqrt{(v_A)_t'^2+(v_A)_n'^2}\\\Rightarrow v_A'=\sqrt{(\dfrac{v_0}{\sqrt{2}})^2+(0.07071v_0)^2}\\\Rightarrow \boldsymbol{v_A'=0.711v_0}

Velocity of ball B after impact is 0.6364v_0 and ball A is 0.711v_0.

5 0
3 years ago
Given asphalt content test data:
VMariaS [17]

Answer:

hello your question is incomplete attached below is the complete question

A) overall mean = 5.535,  standard deviation ≈ 0.3239

B ) upper limit = 5.85, lower limit = 5.0

C) Not all the samples meet the contract specifications

D) fluctuation ( unstable Asphalt content )

Explanation:

B) The daily average asphalt content has to obtained in order to determine the upper and lower control limits using an average asphalt content of 5.5% +/- 0.5% everyday

The upper limit : 14 may = ( 5.8 + 5.1 ) / 2 = 5.85

The lower limit : 16 may = ( 5.2 + 4.8 ) / 2 = 5.0

attached below is the required plot

C ) Not all the samples meet the contract specifications and the samples that do not meet up are samples from :

15 may and 16 may . this is because their Asphalt contents are 6.2 and 4.8 respectively and sample number 18 and 20

D ) what can be observed is that the ASPHALT content fluctuates between the dates while the contract specification is fixed

5 0
4 years ago
Other questions:
  • Given int variables k and total that have already been declared, use a do...while loop to compute the sum of the squares of the
    15·1 answer
  • Water flovs in a pipe of diameter 150 mm. The velocity of the water is measured at a certain spot which reflects the average flo
    13·1 answer
  • in a vehicle you're servicing the fuel pressure drops rapidly when the engine is says that one or more turned off. Technician a
    7·1 answer
  • Which is the correct order for handwashing
    11·2 answers
  • 2. In the above figure, what type of cylinder arrangement is shown in the figure above?
    9·2 answers
  • write an interface downloadable that has a method "geturl" that returns the url of a downloadable object
    5·1 answer
  • Suppose we want to determine how many of the bits in a twelve-bit unsigned number are equal to zero. Implement the simplest circ
    14·1 answer
  • In addition to passing an ASE certification test, automotive technicians must have __________ year(s) of on the job training or
    15·1 answer
  • Travel Planning or Destination Planning will help make your travel more efficient, and not necessary a risk reduction plan as yo
    10·2 answers
  • How many hours should I charge a 4.8 volt 600mah battery(it is urgent)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!