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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education