where is the error? pleasee

. Construct a C++ code that finds and prints the value of SUM by using following series.
SUM = 40*40-38*38+36*36.......+4*4-2*2



#include<iostream>
using namespace std;
int main()
{
int i,s,sum;
cout<<"enter i"<<endl;
cin>>i;

i=40;
sum=0;
s=1;

while(i>=2);
{
sum=sum+s*i*i;
s=-1*s;
i=i-2;
}
cout<<"sum is "<<sum<<endl;
system("pause");
return 0;
}



where is the error:(
Last edited on
while(i>=2); // <- remove the semicolon
thank youu very much :)
Topic archived. No new replies allowed.