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

1. ## [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.

2. Alright my teacher just ended up giving me the code. Lol. Here is the code, and mods you can put solved on the title.

Java 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);
}
}```

3. 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. :(

4. Because that was review and we are having a test today.

5. Maybe, you forgot to ask a question...

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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•