分数相加减的运算
#include<stdio.h>
int main(){
float demo=2;
float sign=1;
float sum=1,term;
while(demo<100){
sign=(-1)*sign;
term=sign/demo;
sum=sum+term;
demo=demo+1;
}
printf("%lf",sum);
}
分数相加减的运算
#include<stdio.h>
int main(){
float demo=2;
float sign=1;
float sum=1,term;
while(demo<100){
sign=(-1)*sign;
term=sign/demo;
sum=sum+term;
demo=demo+1;
}
printf("%lf",sum);
}