include iostream include conio void main void int sum int 10 int kv 10

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream.h>
#include <conio.h>
void main(void)
{
int n=0,i,sum=0, k=2;
int a[10];
int kv[10];
cout <<"Vvedite N, gle N - kol-vo chetnyh naturalnyh chisel"<<endl;
cin>>n ;
if (n%2!=0 && n<=0) cout<<"Vy vveli nepravilnoe chislo";
else
{
for (i=0;i<n;i++)
{
a[i]=k;
kv[i]=a[i]*a[i];
sum=sum+kv[i];
k=k+2;
}
cout<<" Summa kvadratov "<<n<<" chetnyh chisel ravna "<<sum<<endl;
}
getch();
}