public class CountingLooping {
public static void main(String[] args) {
int option = 1;
int[] coinArr = {1, 2, 3, 4, 5};
int[] CoinQtyArr = {1, 2, 3, 4, 5};
int totalCoin = 0;
for (int i = 0; i < 5; i++) {
if (option == 1) {
totalCoin += (coinArr[i] * CoinQtyArr[i]);
} else {
//...
}
}
System.out.println("the total coin are " + totalCoin);
}
}
Comments
0 B
|👍
/👎