|
楼主 |
发表于 2004-7-30 16:12:19
|
显示全部楼层
谢谢qianzheng82了
我是这样解决的
[code:1]#include <stdio.h>
int dx(int t,int v);
int dc(int t,int v,int x);
void print(int x,int y,int t,int v);
main(){
int t,v;
float x,y;
scanf("%d %d",&t,&v);
x=dx(t,v);
y=dc(t,v,x);
print(x,y,t,v);
}
int dx(int f,int u){
int er=u;
while (u>0){
er=f%u;
f=u;
u=er;
}
return (f);
}
int dc(int t,int v,int x){
return ((t*v)/x);
}
void print(int x,int y,int t,int v){
printf("\n%d & %d >>%d\n",t,v,x);
printf("%d $ %d >>%d\n",t,v,y);
} [/code:1] |
|