I am having trouble with implementing the following program  with c++ and would like to know how to correctly implement it

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter9: Completing The Basics
Section9.5: Input Data Validation
Problem 1E
icon
Related questions
Question
100%

I am having trouble with implementing the following program  with c++ and would like to know how to correctly implement it

Loop 1 - Enter integers and at the keyboard. it is assumed that m < n. Output the numbers m, m+1, m+2, ..., n, then output their sum and average with a label. Each should show calculated value with 2 digits to the right of the decimal point.

Loop 2 - Enter integers m and n at the keyboard. it cannot be assume m < n. Output the odd integers in the range [a, b], where a is the least of m, n and b is the largest of m,n.

Loop 3 - Output the numbers 1.3, 1.5, 1.7, ..., 2.9. Show each with 1 digit to the right of the decimal point.

The program run should look like this

Loop 1
Generating numbers from m to n
Enter m and n: 12 16
Expected: integers from 12 to 16
Actual: 12 13 14 15 16
Sum: 70.00 Average: 14.00

Loop 2
Generating odd numbers in a range entered by the user
Enter m and n: 27 20
Expected: odd integers from 20 to 27
Actual: 21 23 25 27

Loop 3
Generating numbers from 1.3, 1.5, ..., 2.9
Expected: 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9
Actual: 1.3 1.5 1.7 1.9 2.1 2.3 2.5 2.7 2.9

Expert Solution
Step 1 Odd numbers

The condition for finding whether a number is odd is num%2!=0 

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning