EVEN_SUM_editorial

Practice

Author: Shadab Shaikh
Tester: Shadab Shaikh](sshadab_148 | CodeChef User Profile for shadab shaikh | CodeChef)
Editorialist: Shadab Shaikh

DIFFICULTY:

CAKEWALK

PREREQUISITES:

None

PROBLEM:

You are given a number NN.You want to find the sum of the first NN Even Number.

SOLUTIONS:

Setter's Solution

#include
using namespace std;

int main()
{
int n,sum=0,k,t,i,s;
cin>>t;
for(k=0;k<t;k++){
cin>>n;
for(s+=2;i<=n;i++)
{
sum = sum+2*i;
}
cout<<sum<<ā€œ\nā€;
}

return 0;

}