Click here to Skip to main content
13,004,870 members (68,402 online)
Rate this:
Please Sign up or sign in to vote.
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
_Amy 13-Sep-12 3:06am
Great tag Homework. :thumbsup: :D
pasztorpisti 13-Sep-12 3:44am
How about GimmeCode and NoEffort?
@amitgajjar 13-Sep-12 3:57am
i like his truth :)
Rate this: bad
Please Sign up or sign in to vote.

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: bad
Please Sign up or sign in to vote.

Solution 2

We won't do your homework...


  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!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170627.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100