You need to declare a variable to hold the sum:
int f, sum = 0;
for (int k = 1; k <= 6 ; k++){
System.out.println("Type " + k +". number");
f = userInput.nextInt();
sum += f;
}
solved Counting amount in Java loop [closed]
You need to declare a variable to hold the sum:
int f, sum = 0;
for (int k = 1; k <= 6 ; k++){
System.out.println("Type " + k +". number");
f = userInput.nextInt();
sum += f;
}
solved Counting amount in Java loop [closed]