Exercise 2: Count the Numbers Write a program that prompts the user to enter a number n. Then, it asks the user to enter a sequence of numbers ending with -999. The program then displays the count of numbers in the sequence smaller than n, the count of numbers larger than n, and the count of numbers equal to n. Sample input/output: Enter the value of n: 56 Enter a number, -999 to stop: 67 Enter a number, -999 to stop: 23 Enter a number, -999 to stop: 19 Enter a number, -999 to stop: 88 Enter a number, Enter a number, Enter a number, Enter a number, -999 to stop: 56 -999 to stop: 12 -999 to stop: 85 -999 to stop: 55 Enter a number, -999 to stop: -999 There are 4 numbers less than 56 There are 3 numbers grater than 56 There are 1 numbers equal to 56

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 5PP
icon
Related questions
Question
Exercise 2: Count the Numbers
Write a program that prompts the user to enter a number n. Then, it asks the user to enter a sequence
of numbers ending with -999. The program then displays the count of numbers in the sequence smaller
than n, the count of numbers larger than n, and the count of numbers equal to n.
Sample input/output:
Enter the value of n: 56
Enter a number, -999 to stop: 67
Enter a number,
Enter a number,
Enter a nu er,
Enter a number,
Enter a number,
Enter a number,
Enter a number,
-999 to stop: 23
-999 to stop: 19
-999 to stop: 88.
-999 to stop: 56
-999 to stop: 12
-999 to stop: 85
-999 to stop: 55
Enter a number, -999 to stop: -999
There are 4 numbers less than 56
There are 3 numbers
There are 1 numbers
grater than 56
equal to 56
Transcribed Image Text:Exercise 2: Count the Numbers Write a program that prompts the user to enter a number n. Then, it asks the user to enter a sequence of numbers ending with -999. The program then displays the count of numbers in the sequence smaller than n, the count of numbers larger than n, and the count of numbers equal to n. Sample input/output: Enter the value of n: 56 Enter a number, -999 to stop: 67 Enter a number, Enter a number, Enter a nu er, Enter a number, Enter a number, Enter a number, Enter a number, -999 to stop: 23 -999 to stop: 19 -999 to stop: 88. -999 to stop: 56 -999 to stop: 12 -999 to stop: 85 -999 to stop: 55 Enter a number, -999 to stop: -999 There are 4 numbers less than 56 There are 3 numbers There are 1 numbers grater than 56 equal to 56
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Mathematical functions
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
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