摘要:
#includeint fac(int n){int f;if(n<0) //n不能小于0printf("n小于0,data error!");elseif(n==0||n==1) //当n=1或0时,n!=1 f=1;elsef=fac(n-1)*n; //当n大于1时,n!=n*(n-1)!return f;}int main(){int n,sum;printf("please enter integer number:");scanf("%d",&n);sum=fac(n);printf("sum=%d 阅读全文
摘要:
#include#include#define size 10int i,a[size],*p; //定义全局变量i,全局数组a[size],全局指针pvoid shuru1(){ FILE *fp;if((fp=fopen("shu.dat","w"))==NULL) { printf("can't open file!\n"); exit(0); }printf("请输入内容:");for(i=0;i<size;i++){ scanf("%d",&a[i]); fput 阅读全文