heres a problem for u

write a program that reads a list of integers from the keyboard and closes the following:

a. Finds and prints the sum and the average of the integers
b. Finds and prints the largest and the smallest of the integers
c. Prints a message if some of them are less than 20
d. Prints a message if all of them are between 10 and 90

The input data consist of a list of integers with a sentinel. The program must prompt the user to enter the integers, one by one, and enter the sentinel when the end of the list has been reached. The promt should look like the following:
Enter numbers (99999 to stop)

The output should be formatted as shown below using "true" or "false" for the last two outputs:

Number of integers: xxx
Sum of integers: xxxx
Average: xxx.xx
Smallest integer: xxx
Largest integer: xxx
Number(s) < 20 false
All in range true

Good luck!

Recommended Answers

All 5 Replies

>heres a problem for u
We don't do homework, and the "Here's a nifty problem for you, but be sure to post it so that I can steal it for my class" trick is a common one.

I think you will find this does it all.


int main()
{
printf("no."\n);
}

or this:

int main()
{
printf("sure, give me $40, and ill give you the wrong answer."\n);
return "$40 bucks for me!";
}

Joke code is funnier when it's correct, guys. ;)

dang it...i knew that wouldn't work...i did it myself anyhow ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.