Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
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
Updated 12-Sep-12 21:44pm
v3
Comments
_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 :)

We won't do your homework...

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!
 
Share this answer
 
Comments
bbirajdar 13-Sep-12 5:08am    
Correct guidance . Exactly what a student should be given by a tutor...+5
Joan M 13-Sep-12 5:11am    
Thank you aspnet_regiis!
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?[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900