#include #include int divisor(int a,int b){ int r; while ((r=a%b)!=0) {a=b;b=r;} return b;}int multiple(int a,int b){ int d; d=divisor(a,b); return a*b/d;}void main(){ int a,b,c; clrscr(); printf("I... Read More
posted @ 2007-01-14 16:42 齐心 Views(663) Comments(0) Diggs(0) Edit
#include #include void hanoi(int,int,int,int);void main(){ int n; clrscr(); printf("Input n:"); scanf("%d",&n); hanoi(n,1,2,3);}void hanoi(int n,int a,int b,int c){ if (n==1) printf("%d-%d",a,c); ... Read More
posted @ 2007-01-14 14:37 齐心 Views(358) Comments(0) Diggs(0) Edit
int gcd(int m,int n){ int g; if (n==0) g=m; else g=gcd(n,m%n) return g;}void main(){ int m,n; scanf("%d,%d",&m,&n); printf("gcd=%d",gcd(m,n));} Read More
posted @ 2007-01-14 10:36 齐心 Views(3131) Comments(0) Diggs(0) Edit
#include #include long fac(int);long comb(int n,int m);void main(){ int n,m; long result; clrscr(); scanf("%d,%d",&n,&m); result=comb(n,m); /**//*调用组合函数*/ printf("%ld",result);}long fac(int k... Read More
posted @ 2007-01-14 09:38 齐心 Views(491) Comments(0) Diggs(0) Edit
long fac(int k){ long f=1; for (int i=1;i#include long fac(int);void main(){ int k; long result; clrscr(); scanf("%d",&k); result=fac(k); printf("%ld",result);}long fac(int k){ long f=1; for (int i=1;... Read More
posted @ 2007-01-13 11:29 齐心 Views(1881) Comments(0) Diggs(0) Edit