Advertisement
JeffGrigg

CountingLooping

Dec 5th, 2018
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.48 KB | None | 0 0
  1. public class CountingLooping {
  2.     public static void main(String[] args) {
  3.         int option = 1;
  4.         int[] coinArr = {1, 2, 3, 4, 5};
  5.         int[] CoinQtyArr = {1, 2, 3, 4, 5};
  6.  
  7.         int totalCoin = 0;
  8.         for (int i = 0; i < 5; i++) {
  9.             if (option == 1) {
  10.                 totalCoin += (coinArr[i] * CoinQtyArr[i]);
  11.             } else {
  12.                 //...
  13.             }
  14.         }
  15.         System.out.println("the total coin are " + totalCoin);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement