Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a function with the following declaration: int numberSaver() Your program should operate as follows: Ask a user to input numbers from 1 to 9

Make a function with the following declaration: int numberSaver() Your program should operate as follows:

  • Ask a user to input numbers from 1 to 9 continuously, until they input a zero. Assume user will not input anything invalid.
  • Use an array of size 9, where you will store the count of how many times user typed in each number.
  • When user inputs 0, the function should print how many of each number user inputted and return the sum of these numbers.

Your output format & function declaration must match the examples EXACTLY to receive credit.

Example output:

Input number from 1 to 9 (0 to exit): 9 Input number from 1 to 9 (0 to exit): 4 Input number from 1 to 9 (0 to exit): 5 Input number from 1 to 9 (0 to exit): 4 Input number from 1 to 9 (0 to exit): 0 You typed: 1) 0 time(s) 2) 0 time(s) 3) 0 time(s) 4) 2 time(s) 5) 1 time(s) 6) 0 time(s) 7) 0 time(s) 8) 0 time(s) 9) 1 time(s)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions