[ad_1]
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;
}
[ad_2]
solved Counting amount in Java loop [closed]
[ad_1]
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;
}
[ad_2]
solved Counting amount in Java loop [closed]