#include<stdio.h>
#include<stdlib.h>//文件要的头文件
int main()
{
FILE *fp;
double y;
int x ;
//写文件
if((fp=fopen("k5.txt","w"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
for(x=0;x<360;x++)
{
fprintf(fp,"%lf\n",x);
}
fclose(fp);
//读文件
if((fp=fopen("k5.txt", "r"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
while(fscanf(fp,"%lf",&y)!=EOF)
{
printf("%lf\n",y);
}
//while(!feof(fp))
//{
// fscanf(fp,"%lf",&y);
// printf("%lf\n",y);
//}
fclose(fp);
return 0;
}
方便打表
将打表出来的结果输入到http://oeis.org/?language=english(这个网站会帮你找规律和最后的公式)