13,004,870 members (68,402 online)
Rate this:
See more:
write a program that asks the user for how many integer numbers to input. Then ask the user for that many numbers. Print out the sum of the numbers and the average.
Posted 12-Sep-12 18:50pm
Updated 12-Sep-12 21:44pm
v3
_Amy 13-Sep-12 3:06am

Great tag Homework. :thumbsup: :D
pasztorpisti 13-Sep-12 3:44am

@amitgajjar 13-Sep-12 3:57am

i like his truth :)

Rate this:

## Solution 1

This seems like school or university assignment, assume that your teacher or lecturer is also reading these forums.

You should try something by your side first and then post question if you get stuck somewhere. You MUST try here[^] first.

You must refer How to ask a good question?[^]
Rate this:

## Solution 2

But:

1. Learn how to show messages in the console (printf will do it).

2. Learn to get numbers entered by the user. scanf or similar functions will help you.

3. Learn how to loop in that case a for loop will do it as you know how many numbers have to be asked.

4. Be clever and use only a numeric variable to store the sum and increase that variable inside the loop.

Note: be careful, if you enter big numbers you can suffer from overflow when making the addition.

Now, with all that information, you can start using google to learn how the functions work. Then my recommendation is that you should design the app using a pencial and a paper, and at the end you should start programming.

Divide and conquer! <= this is one of the most useful tips one can give you. It always works and it is the only way to do it.

Good luck!
aspnet_regiis 13-Sep-12 5:08am

Correct guidance . Exactly what a student should be given by a tutor...+5
Joan Murt 13-Sep-12 5:11am

Thank you aspnet_regiis!

Top Experts
Last 24hrsThis month
 RickZeeland 135 OriginalGriff 130 F-ES Sitecore 125 Dave Kreskowiak 105 ppolymorphe 90
 OriginalGriff 5,060 ppolymorphe 2,617 RickZeeland 2,495 Kornfeld Eliyahu Peter 2,126 Richard Deeming 1,733

Web02 | 2.8.170627.1 | Last Updated 13 Sep 2012