Assalamu Alaikum. Hope you all are well by the grace of Almighty ALLAH. Today we learn how to find out the sum of square series. Take a look at the problem.
Problem: Evaluate the following series up to n.
1^2 + 2^2 + 3^2 +..........
Sample Input: 5
Sample Output: 55
Solution:
Problem: Evaluate the following series up to n.
1^2 + 2^2 + 3^2 +..........
Sample Input: 5
Sample Output: 55
Solution:
We know that 1^2 + 2^2 + 3^2 + 4^2 +......+ n^2 = { n*(n+1)*(2n+1) } / 6. In this program we apply this formula. Take a look at the program.
Thank you all..:)
0 comments:
Post a Comment