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
A sheet of steel 3-mm thick has nitrogen atomospheres on both sides at 900 C and is permitted to achieve a steady-state di usion
kati45 [8]

Answer:

X_B = 1.8 \times 10^{-3} m = 1.8 mm

Explanation:

Given data:

Diffusion constant for nitrogen is = 1.85\times 10^{-10} m^2/s

Diffusion flux = 1.0\times 10^{-7} kg/m^2-s

concentration of nitrogen at high presuure = 2 kg/m^3

location on which nitrogen  concentration is 0.5 kg/m^3   ......?

from fick's first law

J = D \frac{C_A C_B}{X_A X_B}

Take C_A as point  on which nitrogen concentration is 2 kg/m^3

x_B = X_A + D\frac{C_A -C_B}{J}

Assume X_A is zero at the surface

X_B = 0 + ( 12\times 10^{-11} ) \frac{2-0.5}{1\times 10^{-7}}

X_B = 1.8 \times 10^{-3} m = 1.8 mm

4 0
3 years ago
Before cutting coarse screw threads, the operator should lubricate: A. The leadscrew and gearbox B. The ways and cross slide C.
Maksim231197 [3]

Answer:

(d) all of the above

Explanation:

before cutting the screw threads the operator should lubricate all of the machine parts given in the option that is lead screw and gearbox , the ways and the cross slide and the carriage and half-nuts. we should use lubrication because it reduces the overall system friction and if friction is reduced then heat generated due to friction is also decreases which is beneficial

so option (D) will be correct because we need lubricate in all the given parts  

8 0
3 years ago
Handsaw teeth are very sharp: to avoid being cut by the teeth, keep hands and fingers well away from the
siniylev [52]
Handsaw teeth are very sharp: to avoid being cut by the teeth, keep hands and fingers well away from the
path of the blade
6 0
3 years ago
Read 2 more answers
You are about to perform PMCS on your M1114? What resource should you use for the procedures and instructions for performing PMC
aniked [119]

The resources and instructions that should be used for the procedures of performing PMCS are:

  1. Operator's manuals
  2. Safety cautions and warnings.
  3. Fording kit
  4. Heating and cooling systems.

<h3>What is PMCS?</h3>

PMCS is an acronym for preventive maintenance checks and services and it can be defined as the maintenance, checks, and services that are typically performed before, during, and after the use of any type of military equipment such as:

  • M1114
  • M1151
  • M1123

Basically, the resources and instructions that should be used for the procedures of performing PMCS are:

  1. Operator's manuals
  2. Safety cautions and warnings.
  3. Fording kit
  4. Heating and cooling systems.

Read more on PMCS here: brainly.com/question/15720250

#SPJ1

4 0
1 year ago
What components are included in a basic engine block?
atroni [7]
Houses the CYLINDERS, Water Jacket & Crankcase
8 0
3 years ago
Other questions:
  • With 64 KB of memory and 8 bits in each memory location, how wide should the address bus be to access all 64 KB of memory? (k =
    11·1 answer
  • A circular section of material is tested. The original specimen is 200 mm long and has a diameter of 13 mm. When loaded to its p
    11·2 answers
  • Block B starts from rest, block A moves with a constant acceleration, and slider block C moves to the right with a constant acce
    11·1 answer
  • Some chemical reaction is being run inside a sealed gas cylinder. During the reaction, a gaseous product is formed. The pressure
    14·1 answer
  • The use of zeroes after a decimal point are an indicator of accuracy. a)True b)- False
    7·1 answer
  • If a and b are both int arrays, then a b; will
    10·1 answer
  • Select the correct answer. Which statement best describes a hydrogen fuel cell? A This device uses bioethanol as an additive to
    9·2 answers
  • A machine used to shred cardboard boxes for composting has a first cost of $10,000, an AOC of $7000 per year, a 3-year life, and
    14·1 answer
  • Why might many general contractors begin their careers as construction workers?
    9·1 answer
  • 2. A F-22 Raptor has just climbed through an altitude of 9,874 m at 1,567 kph when a disk
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!