第一道:
#include <stadio.h>
double f ( int n )
{ int i; double s;
s=1.0;
for ( i=1;i<=n;i++) s+=1.0/i;
return s;
}
main ( )
{ int i, m=3; double a=0.0
for ( i=0; i<m;i++) a+=f(i)
printf ("%f\n",a)
}
第二道:
#include <stdio.h>
double sub (doule x,double y, double z)
{ y-=1.0;z=z+x;return z;}
main ( )
{ double a=2.5,b=9.0;
printf ("%f\n", sub ( b-a,a,a ) )
}
第三道:
#include <stdio.h>
int fun2 ( int a,int b)
{ int c;
c=(a*b)%3; return c;
}
int fun1 ( int a, int b )
{ int c;
a+=a; b+=b; c=fun2 ( a,b );
return c*c;
}
main ( )
{ int x=11,y=19;
printf ("%d\n",fun1 ( x,y ) );
}
帮忙解一下这三道题,是怎样得出结果的?