Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a C++ assignment. write a program that uses do while loops to perform the following steps: a. Prompt the user to input two

This is a C++ assignment. write a program that uses do while loops to perform the following steps: a. Prompt the user to input two positive integers. variables: firstNum and secondNum (firstNum must be less than secondNum). Validate the user's input; prompt the user again if firstNum is not less than secondNum (use do while loop). b. Output all odd numbers between firstNum and secondNum. (use do while loop). c. Output the sum of all even numbers between firstNum and secondNum. (use do while loop). d. Output the numbers and their squares between 1 and 10. (use do while loop). e. Output the sum of the square of the odd numbers between firstNum and secondNum. (use do while loop) f. Output all uppercase letters. (use do while loop).

Program layout:

int main()

{

//a

do

{

} while()

//b

do

{

} while()

//c

do

{

} while()

//d

do

{

} while()

//e

do

{

} while()

//f

do

{

} while()

}

OUTPUTS:

**************************************************************************************

Enter two positive integer numbers. First number must be less than the second number: Enter numbers: 8 2

First number must be less than the second number! Please try again.

**************************************************************************************

Enter two positive integer numbers. First number must be less than the second number: Enter numbers: -2 8

No negative numbers! Please try again.

**************************************************************************************

Enter two positive integer numbers. First number must be less than the second number you enter Enter numbers: 2 8

Odd integers between 2 and 8 are: 3 5 7

Sum of even integers between 2 and 8 = 20

Number Square of Number 1 1 2 4 3 9 4 16 5 25 6 36 7 49 8 64 9 81 10 100

Sum of the squares of odd integers between 2 and 8 = 83

Upper case letters are: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

**************************************************************************************

Enter two positive integer numbers. First number must be less than the second number you enter Enter numbers: 1 9

Odd integers between 1 and 9 are: 1 3 5 7 9

Sum of even integers between 1 and 9 = 20

Number Square of Number 1 1 2 4 3 9 4 16 5 25 6 36 7 49 8 64 9 81 10 100

Sum of the squares of odd integers between 1 and 9 = 165

Upper case letters are: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

**************************************************************************************

Enter two positive integer numbers. First number must be less than the second number you enter Enter numbers: 11 15

Odd integers between 11 and 15 are: 11 13 15

Sum of even integers between 11 and 15 = 26

Number Square of Number 1 1 2 4 3 9 4 16 5 25 6 36 7 49 8 64 9 81 10 100

Sum of the squares of odd integers between 11 and 15 = 515

Upper case letters are: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

**************************************************************************************

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago