2010年11月20日

摘要: char result[100];void add(char *s1,char *s2){ char a[100],b[100]; int i,Len,Len1,Len2,k; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); memset(result,0,sizeof(result)); Len1=strlen(s1); Len2=strlen(s2); if(Len1>Len2) Len=Len1; else Len=Len2; k=0; for(i=Len1-1;i>=0;i--... 阅读全文
posted @ 2010-11-20 21:03 yming0221 阅读(157) 评论(0) 推荐(0)
摘要: 最大公约数(greatest common divisor,简写为gcd;或highest common factor,简写为hcf),指某几个整数共有因子中最大的一个。int gcd(int a,int b){ int r; if(a<0) a=-a; while(b!=0) { r=a%b; a=b; b=r; } return a;}int gcd(int x,int y) { while(x!=y) { if(x>y) x-=y; else y-=x; } return x;} 阅读全文
posted @ 2010-11-20 20:33 yming0221 阅读(143) 评论(0) 推荐(0)

导航