level 5
小小鱼大泡泡
楼主
求两数的比值
function bi(a,b)
variable aa=a , bb=b , c=0 , d=0 , hh=true
if(a==b)
print("两数之比为1:1")
hh=false
endif
while(hh)
if(a>b)
c=mod(a,b)
if(c==0)
d=b
hh=false
print("两数之比为"+aa/d+":"+bb/d)
else
a=c
endif
else
c=mod(b,a)
if(c==0)
d=a
hh=false
print("两数之比为"+aa/d+":"+bb/d)
else
b=c
endif
endif
loop
endf
2016年08月23日 17点08分
1
function bi(a,b)
variable aa=a , bb=b , c=0 , d=0 , hh=true
if(a==b)
print("两数之比为1:1")
hh=false
endif
while(hh)
if(a>b)
c=mod(a,b)
if(c==0)
d=b
hh=false
print("两数之比为"+aa/d+":"+bb/d)
else
a=c
endif
else
c=mod(b,a)
if(c==0)
d=a
hh=false
print("两数之比为"+aa/d+":"+bb/d)
else
b=c
endif
endif
loop
endf