#include <math.h>
#include <stdio.h>
double fun( int n)
{ int i,sum;
double ss;
for( i=7;i<n;i++)
if(i%3==0&&i%7==0) sum+=i;
ss=sqrt((double)sum);
return ss;
}
main()
{
FILE *out;
clrscr();
printf("s=%f\n", fun ( 3721));
out=fopen ("out.dat", "w");
fprintf(out, "s=%f\n", fun(3721));
fclose (out );
getch();
}
#include <conio.h>
#include <math.h>
#include <stdio.h>
double fun( int n)
{ int i;
double ss=0.0;
for( i=7;i<n;i++)
if(i%3==0&&i%7==0) ss+=i;
ss=sqrt(ss);
return ss;
}
main()
{
FILE *out;
clrscr();
printf("s=%f\n", fun ( 3721));
out=fopen ("out.dat", "w");
fprintf(out, "s=%f\n", fun(3721));
fclose (out );
getch();
}
实在找不出哪里不一样,快二级考试了,急啊
----------------解决方案--------------------------------------------------------