Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please make sure all criteria is met, including formatting and spacing. Thanks! Create a C program that will ask a user to enter a number

image text in transcribed

Please make sure all criteria is met, including formatting and spacing. Thanks!

Create a C program that will ask a user to enter a number repeatedly. This program will calculate 2 averages based on whether the sum of the digits in the inputted numbers are odd or even: avg_even (average of all inputs whose digits sum up to an even number) and avg_odd (average of all inputs whose digits sum up to an odd number). The program will stop when the user enters a "0" (number zero). For example, 2, 26, and 123 are numbers whose digits sum to an even number. The code output must match the sample runs exactly, including spacing, formatting, etc. Incorporate the behavior 1 st integer, 2nd integer, 100th integer, xth integer, etc. into your program Enter the 1st number: 2 Enter the 2nd number: 26 Enter the 3 rd number: 123 Enter the 4 th number: 3 Enter the 5 th number: 14 Enter the 6th number: 111 Enter the 7th number: 0 Average of inputs whose digits sum up to an even number: 50.33 Average of inputs whose digits sum up to an odd number: 33.33 Enter the 1st number: 92 Enter the 2nd number: 142 Enter the 3 rd number: 7 Enter the 4th number: 36 Enter the 5 th number: 0 Average of inputs whose digits sum up to an odd number: 1.75 Enter the 1st number: 0 There is no average to compute

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

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions