Using a while loop, write a program to calculate and print the sum of a given number of squares.

Question

a) Using a while loop, write a program to calculate and print the sum of a given number of squares. For example, if 5 is input, then the program will print 55, which equals 12 + 22 + 32 + 42 + 52.

b) Reimplement this program using a for loop.

( In JavaScript )

Details
Purchase An Answer Below

Have a similar question?