Computer Science, asked by nevonj2am, 2 months ago

write a python program to print the sum of the squares of even numbers upto a limit

Answers

Answered by libakanhekar14
1

Answer:

Bro pls note all the '2' at the end of the numbers r squres.....eg.22=2 squre.and so on pls be care ful with answer.

Explanation:

Sum of square of first n even numbers

Given a number n, find sum of square of first n even natural numbers.

Examples :

Input : 3

Output : 56

22 + 42 + 62 = 56

Input : 8

Output : 816

22 + 42 + 62 + 82 + 102 + 122 + 142 +162

A simple solution is to traverse through n even numbers and find the sum of square.

// Simple C++ method to find sum

// of square of first n even numbers.

#include <iostream>

using namespace std;

int squareSum(int n)

{

int sum = 0;

for (int i = 1; i <= n; i++)

sum += (2 * i) * (2 * i);

return sum;

}

// Driver Code

int main()

{

cout << squareSum(8);

return 0;

}

Output:

816

Similar questions