#include <stdio.h>
int main(){
//用while循环求 1-1/2+1/3-1/4+1/5-1/6+........-1/100 的和
double n ,sum=0;
n=1.0;
while (n<=100&&n%2!=0){
sum =sum-i;
i++;
}
else
while (n<=100&&n%2=0){
sum =sum+i;
i++;
}
double sum = sum+sum;
printf("%lf",sum);
return 0;
}
int main(){
//用while循环求 1-1/2+1/3-1/4+1/5-1/6+........-1/100 的和
double n ,sum=0;
n=1.0;
while (n<=100&&n%2!=0){
sum =sum-i;
i++;
}
else
while (n<=100&&n%2=0){
sum =sum+i;
i++;
}
double sum = sum+sum;
printf("%lf",sum);
return 0;
}