DevC++中没问题 这里有问题
#include<stdio.h>
int main()
{
int sum=0,p,i=1;
while(i<=100)
{
sum=sum+p*i;p=-1*p,i+=1;
}
printf("sum=%d\n",sum);
}
#include<stdio.h>
int main()
{
int sum=0,p,i=1;
while(i<=100)
{
sum=sum+p*i;p=-1*p,i+=1;
}
printf("sum=%d\n",sum);
}
2021-09-15
举报