Write a program that uses a while loop to enable the user to enter any number of positive integers. The loop should end when a sentinel value of 0 (zero) is entered. The program should then report the sum of the even integers and the sum of the odd integers

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter1: An Overview Of Computers And Programming Languages
Section: Chapter Questions
Problem 18SA: 18. Tom and Jerry opened a new lawn service. They provide three types of services: mowing,...
icon
Related questions
Question

program4_2.py
Write a program that uses a while loop to enable the user to enter any number of positive integers. The loop should end when a sentinel value of 0 (zero) is entered. The program should then report the sum of the even integers and the sum of the odd integers.

 

Please enter a positive number (0 to quit):1
Please enter a positive number(0 to quit):2
Please enter a positive number(0 to quit):3
Please enter a positive number(0 to quit):4
Please enter a positive number(0 to quit):5
Please enter a positive number(0 to quit):6
Please enter a positive number (0 to quit):7
Please enter a positive number(0 to quit):8
Please enter a positive number (0 to quit):9
Please enter a positive number (0 to quit):0
Total even integers: 20
Total odd integers: 25
Transcribed Image Text:Please enter a positive number (0 to quit):1 Please enter a positive number(0 to quit):2 Please enter a positive number(0 to quit):3 Please enter a positive number(0 to quit):4 Please enter a positive number(0 to quit):5 Please enter a positive number(0 to quit):6 Please enter a positive number (0 to quit):7 Please enter a positive number(0 to quit):8 Please enter a positive number (0 to quit):9 Please enter a positive number (0 to quit):0 Total even integers: 20 Total odd integers: 25
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Basics of loop
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning