Advertisement
ggeorgiev88

pyramid2

Jan 16th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function pyramidOfKing(base, hight) {
  2.     let stoneCounter = 0;
  3.     let marbleCounter = 0;
  4.     let lapisCounter = 0;
  5.     let goldCounter = 0;
  6.     let flourCounter = 0;
  7.     let dcorativeBriks = 0;
  8.     let coreBriks = 0;
  9.  
  10.  
  11.  
  12.     for (let x = base; x > 1; x -= 2) {
  13.         let currentFloorBriks = x * x;
  14.         flourCounter++;
  15.         coreBriks = (x - 2) * (x - 2);
  16.         dcorativeBriks = currentFloorBriks - coreBriks;
  17.         stoneCounter += coreBriks;
  18.  
  19.         if (flourCounter % 5 !== 0) {
  20.             marbleCounter += dcorativeBriks;
  21.         } else if (flourCounter % 5 === 0) {
  22.             lapisCounter += dcorativeBriks;
  23.  
  24.         }
  25.  
  26.  
  27.  
  28.  
  29.  
  30.     }
  31.  
  32. }
  33.  
  34. pyramidOfKing(11, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement