用C语言编写程序,计算表达式1-1/2+1/3-1/4+1/5的结果. 在线等。

如题所述

#include "stdio.h"
int main()
{
    float i,s,t;
    t=1;
    s=0;
for(i=1;i<=5;i++)
    {
     s+=t/i;
     t=-t;
    }
printf("%f",s);
}

温馨提示:答案为网友推荐,仅供参考
相似回答