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
Technician A says that proper footwear may include both leather and steel-toed shoes. Technician B says that leather-soled shoes
Amanda [17]

Given:

We have given two statements.

Statement 1: Proper footwear may include both leather and steel-toed shoes.

Statement 2:  Leather-soled shoes provide slip resistance.

Find:

Which statement is true.

Solution:

A slip-resistant outsole is smoother and more slip-resistant than other outsole formulations when exposed to water and oil. A smoother outsole in rubber ensures a slip-resistant shoe can handle a slippery floor more effectively.

Slip resistant shoes have an interlocked tread pattern that does not close the water in, enabling the slip resistant sole to touch the floor to provide better slip resistance.

Leather-soled shoes don't provide slop resistance.

Therefore, both the Technicians are wrong.

5 0
3 years ago
A plot of land is an irregular trangle with a base of 122 feet and a height of 47 feet what is the area of the plot?
Reika [66]

Answer:

150 is the area

Explanation:

3 0
3 years ago
Each of the following activities are commonly performed during the implementation of the Database Life Cycle (DBLC). Fill in the
kicyunya [14]
Yessiree I agree with yu cause yu are right
4 0
3 years ago
Who here is a genius?
Pachacha [2.7K]

Answer:

im kinda smart  whyy?

Explanation:

3 0
3 years ago
Read 2 more answers
8. Describe and correct the error in stating the domain. Xf * (x) = 4x ^ (1/2) + 2 and g(x) = - 4x ^ (1/2) The domain of (f + g)
konstantin123 [22]

Answer:

hi

Explanation:

4 0
3 years ago
Other questions:
  • Your task is to fill in the missing parts of the C code to get a program equivalent to the generated assembly code. Recall that
    5·1 answer
  • The density of oxygen contained in a tank is 2.0 kg/m3 when the temperature is 25 °C. Determine the gage pressure of the gas if
    12·1 answer
  • Given the following data, plot the stress-strain curves for the two unknown materials on the same set of stress-strain axes. Den
    9·1 answer
  • What are the challenges posed by strategic information systems, and how should they be addressed?
    10·1 answer
  • Generally natural shape of stone is in shaped as (a)angular (b)irregular (c)cubical cone shape (d)regular
    10·2 answers
  • During an experiment conducted in a room at 25°C, a laboratory assistant measures that a refrigerator that draws 2 kW of power h
    13·1 answer
  • Following lockout/tagout (LOTO) procedures is important but not required when working with dangerous
    10·1 answer
  • In a surface grinding operation, the wheel diameter = 8.0 in, wheel width = 1.0 in, wheel speed = 6000 ft/min, work speed = 40 f
    9·1 answer
  • A rigid vessel with a volume of 10 m3 contains a water-vapor mixture at 400 kPa. If the quality is 60 percent, find the mass. Th
    11·1 answer
  • The current at resonance in a series L-C-R circuit is 0.2mA. If the applied voltage is 250mV at a frequency of 100 kHz and the c
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!