Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sides(num) {
- total = 1;
- for (let i = 2; i <= num; i++) {
- top = 1;
- sides = (i - 1) * 4;
- bottom = i - 2;
- total += top + sides + bottom;
- }
- return total;
- }
- function pentagon(num) {
- total = 1;
- for (let i = 2; i <= num; i++) {
- answer = (((i - 1) * 4) + 1) + (i - 2);
- total += answer
- }
- return total;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement