#include <stdio.h>
int main(void)
{
int flag, n
double eps, item, s
printf("Input eps:")
scanf("%lf", &eps)
flag = 1
s = 0
n = 1
do
{
item = 1.0 / n
s = s + flag * item
flag = -flag
n = n + 3
} while (item >= eps)
printf("s=%f\n", s)
return 0
}
第一,min函数的形参a和b必须加上类型符。
int min(int a,int b)
{int c
c=a>b?b:a
return c}
void main()
{int x,y
printf("please input x&y:")
scanf("%d%d",&x,&y)
printf("%d",min(x,y))}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)