Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement