void main()
{
int n,i,sum=0;
clrscr();
printf("\n PLEASE ENTER THE VALUE OF N: ");
scanf("%d",&n);
printf("\n\n SUM = ");
for(i=1;i<=n;i++)
{
if(i%2==1)
{
if(i==1)
sum=1;
else
sum=sum-i*i;
if(i==n)
printf("%d",i*i);
else
printf("%d + ",i*i);
}
else
{
sum=sum+i*i;
if(i==n)
printf("%d",i*i);
else
printf("%d - ",i*i);
}
}
printf("\n THE SUM IS %d",sum);
getch();
}
*************************** OUTPUT ************************
PLEASE ENTER THE VALUE OF N: 6
SUM = 1 + 4 - 9 + 16 - 25 + 36
THE SUM IS 23
PLEASE ENTER THE VALUE OF N: 7
SUM = 1 + 4 - 9 + 16 - 25 + 36 - 49
THE SUM IS -26
***********************************************************