SHARE
TWEET

Untitled

a guest Jun 15th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sides(num) {
  2.     total = 1;
  3.     for (let i = 2; i <= num; i++) {
  4.         top = 1;
  5.         sides = (i - 1) * 4;
  6.         bottom = i - 2;
  7.         total += top + sides + bottom;
  8.     }
  9.     return total;
  10. }
  11.      
  12. function pentagon(num) {
  13.     total = 1;
  14.     for (let i = 2; i <= num; i++) {
  15.         answer = (((i - 1) * 4) + 1) + (i - 2);
  16.         total += answer
  17.  
  18.     }
  19.     return total;
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top