# [SOLVED] Integers (averages and remainders)...need help

• 04-10-2008, 02:52 PM
Zebra
[SOLVED] Integers (averages and remainders)...need help
Hey everybody. I have a new question today that I need help with. Here is the question.

"Make a program that asks the user to input n-integers. And, find the average of the remainders, when each is divided by 4."

...hopefully somebody can help me out. Thanks for your time.
• 04-10-2008, 03:10 PM
Zebra
Alright my teacher just ended up giving me the code. Lol. Here is the code, and mods you can put solved on the title.

Code:

```import java.util.Scanner; class Remainders {         public static void main(String args[])     {             Scanner scan = new Scanner(System.in);             double avg;             double sum = 0;             int num;             System.out.println("How many numbers?");             int n = scan.nextInt();             for(int i = 1; i <= n; i++)             {                     System.out.println("Enter number " + n);                     num = scan.nextInt();                     sum = sum + num % 4;             }             avg = sum/n;             System.out.println("The average of the remainders is " + avg);     }   }```
• 04-11-2008, 05:40 AM
CaptainMorgan
That's strange.. what is the teacher's purpose is handing out the code like this without a student's attempt ? I question his/her pedagogy. :(
• 04-11-2008, 02:58 PM
Zebra
Because that was review and we are having a test today.
• 04-16-2008, 02:26 PM
sukatoa
Maybe, you forgot to ask a question...

Quote:

Hey everybody. I have a new question today that I need help with. Here is the question.

"Make a program that asks the user to input n-integers. And, find the average of the remainders, when each is divided by 4."
Maybe, "Can you show a program that is similar to program that i was specified? i like to have an experiment on it to be able to learn java...

if you feel that you are a noob, well, don't say that....
You might say, i am a beginner, not a noob...

And our experts here, are also came from a beginner, so, you have more chance to be an expert too.. like them... just have patience...

have some experiments on the code, maybe your source is the book or the net....

write it, predict, code it and realize.
sukatoa