JeffGrigg icon

CountingLooping

JeffGrigg | PRO | 12/05/18 11:31:42 PM UTC | 0 ⭐ | 946 👁️ | Never ⏰ | []
Java 5 |

0 B

|

None

|

0 👍

/

0 👎

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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎