C语言用while语句计算1-1/2+1/3-1/4+......,直到最后一项的绝对值小于10^-4为止,留空的地方应该怎么填
#include<stdio.h>#include<math.h>main(){intn=1;floatterm=1.0,sign=1,sum=0;while(){;su...
#include<stdio.h>
#include<math.h>
main()
{
int n = 1;
float term = 1.0,sign = 1,sum = 0;
while( )
{
;
sum = sum+term;
sign = ;
n++;
}
printf("sum = %f\n",sum);
} 展开
#include<math.h>
main()
{
int n = 1;
float term = 1.0,sign = 1,sum = 0;
while( )
{
;
sum = sum+term;
sign = ;
n++;
}
printf("sum = %f\n",sum);
} 展开
2个回答
展开全部
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询