c语言求1-1/2+1/3……
c语言求1-1/2+1/3……
日期:2021-11-16 22:06:59 人气:1
帮你改了一下,你看看:
#include<stdio.h>
#include<stdlib.h>
float Sum(int a)
{
float x = 0;
if(a%2)
x = 1/(float)a;
else
x = -1/(float)a;
return x;
}
main()
{
int n = 0;
#include<stdio.h>
#include<stdlib.h>
float Sum(int a)
{
float x = 0;
if(a%2)
x = 1/(float)a;
else
x = -1/(float)a;
return x;
}
main()
{
int n = 0;