Ask the user to enter a magic number which is an integer


Instructions

Ask the user to enter a "magic number," which is an integer between 0 and 9, inclusive.

Then, ask a user to enter 10 integers between 0 and 9, inclusive. (If a user enters an integer outside of that range, therefore invalid, notify the user of the error and ask for him/her to try again. Invalid numbers do not count towards the 10 valid integers requirement.)

NOTE: User input should be done in a repetition structure (loop). Ten sequential input statements will not satisfy the requirements of this assignment.

Your program should output the following:

How many times the user entered the magic number.

The average of all the valid numbers that the user entered.

Sample Output:

What is the "magic number?" 4

Enter a number from 0 to 9: 4

Enter a number from 0 to 9: 1

Enter a number from 0 to 9: 4

Enter a number from 0 to 9: 3

Enter a number from 0 to 9: 7

Enter a number from 0 to 9: 1

Enter a number from 0 to 9: 5

Enter a number from 0 to

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Ask the user to enter a magic number which is an integer
Reference No:- TGS01033167

Expected delivery within 24 Hours