Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function mining(arr) {
  2.   let totalBC = 0;
  3.   let dayBC = 0;
  4.   let left = 0;
  5.   let days = 0;
  6.   let money = 0;
  7.   let totalMoney = 0;
  8.   for (let i = 0; i < arr.length; i++) {
  9.     days++;
  10.     if (days === 3) {
  11.       arr[i] = arr[i] - (arr[i] * 0.3);
  12.     }
  13.     money = arr[i] * 67.51;
  14.     totalMoney += money;
  15.     while (totalMoney >= 11949.16) {
  16.       totalMoney -= 11949.16;
  17.       totalBC++;
  18.       if (totalBC === 1) {
  19.         dayBC = days;
  20.       }    
  21.     }
  22.   }
  23.   console.log(`Bought bitcoins: ${totalBC}`);
  24.   if (dayBC > 0) {
  25.   console.log(`Day of the first purchased bitcoin: ${dayBC}`);
  26.   }
  27.   console.log(`Left money: ${totalMoney.toFixed(2)} lv.`);
  28. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement