问题描述:
功能:编写函数求3!+6!+9!+12!+15+18!+21!.------------------------------------------------*/ #includ
功能:编写函数求3!+6!+9!+12!+15+18!+21!.
------------------------------------------------*/
#include
void wwjt();
float sum(int n)
{
//
}
main()
{
printf("this sum=%e\n",sum(21));
wwjt();
}
void wwjt()
{
FILE *IN,*OUT;
int i;
float o;
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("Read FILE Error");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("Write FILE Error");
}
fscanf(IN,"%d",&i);
o=sum(i);
fprintf(OUT,"%f\n",o);
fclose(IN);
fclose(OUT);
}
功能:编写函数求3!+6!+9!+12!+15+18!+21!.
------------------------------------------------*/
#include
void wwjt();
float sum(int n)
{
//
}
main()
{
printf("this sum=%e\n",sum(21));
wwjt();
}
void wwjt()
{
FILE *IN,*OUT;
int i;
float o;
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("Read FILE Error");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("Write FILE Error");
}
fscanf(IN,"%d",&i);
o=sum(i);
fprintf(OUT,"%f\n",o);
fclose(IN);
fclose(OUT);
}
问题解答:
我来补答展开全文阅读