View Single Post
  #2 (permalink)  
Old 04-10-2008, 03:10 PM
Zebra's Avatar
Zebra Zebra is offline
Member
 
Join Date: Apr 2008
Location: Louisville, Indiana/Kentucky
Posts: 64
Zebra is on a distinguished road
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); } }
__________________
I am a Java n00b.
Reply With Quote