Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simple Conditionals and Loops Write a program that repetitively requests signed integer numbers between -100 and +100 from the user though the keyboard (using printf()

Simple Conditionals and Loops

Write a program that repetitively requests signed integer numbers between -100 and +100 from the user 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 positive or negative. Create two variables that accumulate the values of the numbers entered - one for the positive numbers and one for the negative numbers. The program shall 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 positive numbers entered, and the number and the total of the negative numbers entered. Then, it should also print out the algebraic total of the sum total of the positive entries minus the sum total of the negative entries.

Furthermore, the users entry must be checked to ensure that it is within the range specified. If it is out of range, then it should print out Entry out of range. Please try again. It should furthermore give the user two more chances to enter a correct value. After two more chances, it should exit without providing an answer, and print out OK, were done here. Bye.

There is no need to save any of the individual values during the program execution - only their cumulative totals and the number of positive and negative numbers (separately!) entered. The output should be as follows:

, the numbers you have entered are broken down as follows:

You entered positive numbers with a total value of

You entered negative numbers with a total value of

The algebraic sum of the total positive and negative entries is:

Where the labels between <> represent the values of the variables that will be printed in its place.

Program Specifications: (musts)

There are several requirements (musts) in this assignment:

1. Your program must make use of at least one conditional structure (doesnt matter which one).

2. Your program must make use of at least one loop structure (doesnt matter which one).

3. Your program must use scanf() to obtain the users entries.

4. Your program must use printf() to print out the results to the screen.

5. Lastly (and obviously!), your program must be written in C and must compile and execute correctly on Code::Blocks using the GCC compiler.

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_2

Step: 3

blur-text-image_3

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

Do you prefer cooking dinner or going out?

Answered: 1 week ago

Question

Question May I set up a Keogh plan in addition to an IRA?

Answered: 1 week ago