Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 19:50pm
Edited 12-Sep-12 22:44pm
v3
Comments
_Amy at 13-Sep-12 3:06am
   
Great tag Homework. :thumbsup: :D
pasztorpisti at 13-Sep-12 3:44am
   
How about GimmeCode and NoEffort?
@amitgajjar at 13-Sep-12 3:57am
   
i like his truth :)
Rate this: bad
good
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?[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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!
  Permalink  
Comments
aspnet_regiis at 13-Sep-12 5:08am
   
Correct guidance . Exactly what a student should be given by a tutor...+5
Joan Murt at 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
0 OriginalGriff 325
1 Peter Leow 135
2 Afzaal Ahmad Zeeshan 125
3 Zoltán Zörgő 120
4 DamithSL 100
0 enhzflep 40
1 Richard Deeming 25
2 OriginalGriff 10
3 Anddos 10
4 Kornfeld Eliyahu Peter 10


Advertise | Privacy | Mobile
Web03 | 2.8.150224.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2015
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