Question: C++ Exercise #2: Simple usage of repetition (while) loops with if statements Write a program that reads in a number of integers from the keyboard.

 C++ Exercise #2: Simple usage of repetition (while) loops with ifC++

Exercise #2: Simple usage of repetition (while) loops with if statements Write a program that reads in a number of integers from the keyboard. The program squares the number if it is even, takes its square root if it is odd, and does nothing if it is zero. The program prints the square of the number, the square root of the number, or nothing. The program counts the number of even numbers, the number of odd numbers, and the number of zeros. The program stops reading numbers when it reads in a negative number. After the program encounters a negative number, it prints out the number of even numbers, the number of odd numbers, and the number of zeros followed by the message "Done." on a new line Sample input/ output: Input integers, one at a time. To stop enter a negative number: 34 1156 Input integers, one at a time. To stop enter a negative number: 77 8.77496 Input integers, one at a time. To stop enter a negative number: 9 Input integers, one at a time. To stop enter a negative number: 13 3.60555 Input integers, one at a time. To stop enter a negative number: 18 324 Input integers, one at a time. To stop enter a negative number: e Input integers, one at a time. To stop enter a negative number: 44 Input integers, one at a time. To stop enter a negative number: e 936 nput integers, one at a time. To stop enter a negative number: -3 The number of positive numbers is: The number of negative numbers is: 3 The number of zeros is: 2 ne

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!