for some reason the command prompt keeps on asking me for input but I am placing a value on line 12 (sum + one) = sum. If you guys could help me determine whats wrong with it that would be amazing.
import java.util.Scanner;
public class FunnyAverage {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.print("How many values to read? ");
int top = in.nextInt();
System.out.print("Enter Value: ");
int one = in.nextInt();
int number = 0;
int sum = 0;
(sum + one) = sum;
while (number>top){
while (one % 6 != 0&&one % 17 != 0) {
System.out.print("Enter Value: ");
one = in.nextInt();
number++;
}
}
if (sum/top != 0){
System.out.print("Average: " + sum/top);
}
System.out.print("None Divisible");
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…