Homework 2 COP 3223C

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (7 votes)

Simple Conditionals, Loops and User‐defined functions
Program Specification: Write a program that requests integer numbers from the user
repetitively though the keyboard (using printf and scanf) until the user enters 0 when
she/he wants to quit. Test each entry for whether the number entered is even or odd. Create
two variables that accumulate the numbers entered, one for the even numbers and the other
for the odd numbers. The program should also ask the name of the user and save it to a string
variable. Upon completion of the data entry process (when the user enters 0), the program
prints out the name of the user, the number and the total of the even numbers entered, and
the number and the total of the odd numbers entered. Use at least one user‐defined functions
besides main(). There is no need to save any of the individual values during the program
execution ‐ only their cumulative totals and the number of even and odd numbers (separately!)
entered. The output should be as follows:
, the numbers you entered are broken down as follows:
You entered even numbers with a total value of .
You also entered odd numbers with a total value of .
Where the labels between < > are the names of the variables whose values will be printed in its
place.
There are several requirements (“musts”) in this assignment:
1. Your program must make use of at least one conditional structure (doesn’t matter which one).
2. Your program must make use of at least one loop structure (doesn’t matter which one).
3. Your program must also use have a user‐defined function besides main().
4. Your program must use scanf() to obtain the user’s integer entries.
5. Your program must use printf() to print out the results to the screen.
6. Lastly (and obviously!), your program must be written in C and must compile and execute correctly
from Code::Blocks
Submission instructions: Same as for HW #1: Submit your program source code as a .c file
through the Webcourses homework submission page. Please name the file as HW2 ‐ and put your full name as the second comment line.