1-3+5-7.....-99
1-3+5-7.....-99的程序怎么做
#include <stdio.h>
int main(void)
{
int a;
int s=1;
int sum=0;
for(a=1;a<=99;a+=2)
{
sum +=s*a;
s=-s;
}
printf("sum=%d",sum);
getch();
}