#include <stdio.h>
int main()
{
long i;
long tmp;
long fib[40];
long a = 1, b = 2;
for (i = 0; i < 40; i++)
{
fib[i] = a + b;
tmp = a;
a = b;
b = b + tmp;
printf ("%ld ", fib[i]);
if(!((i+1)%10))
printf ("\n");
}
if((fp1=fopen("xx.txt","w"))==NULL)
{
printf("File open error!\n");
exit(0);
}
printf("The number ...:\n");
for (i = 0; i<40; i++)
{
if(!(fib[i]%3))
printf ("%ld ", fib[i]);
}
return 0;
}
本人的做法但是文件放不进去 谢谢大家乐