Advertisement
marinvch

Picture in the wall

Apr 15th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve([widthHole, heightHole, pictureSide, pictureCount]) {
  2.     widthHole = Number(widthHole);
  3.     heightHole = Number(heightHole);
  4.     pictureSide = Number(pictureSide);
  5.     pictureCount = Number(pictureCount);
  6.     //Sizes of Hole and Picture
  7.     let wallArea = widthHole * heightHole;
  8.     let pictureArea = pictureSide * pictureSide;
  9.     let pictureSize = pictureArea * pictureCount;
  10.  
  11.     if (wallArea > pictureSize) {
  12.         console.log("The pictures fit in the hole." + " Hole area is " + (wallArea - pictureSize) + " bigger than pictures area.");
  13.         console.log();
  14.     } else if (pictureSize > wallArea) {
  15.         console.log("The pictures don't fit in the hole." + " Picture area is " + (pictureSize - wallArea) + " bigger than hole area.");
  16.  
  17.     }
  18.  
  19.  
  20. }
  21. // solve([10, 5, 2, 3]);
  22. // solve([16, 13, 12, 5]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement