write a program to find the difference between sum of the squares and square of the sums of n numbers
1
Expert's answer
2012-11-08T09:19:09-0500
var n = prompt("Enter n"); if (n == '') {alert('Empty field!');} else { var sumOfSquare = 0; var i; for (i = 1; i <= n; i++) { sumOfSquare += i*i; } var squareOfSum = n*(n+1)/2; alert("Difference is " + (sumOfSquare - squareOfSum)); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment