Jump to content

Greatest common divisor: Difference between revisions

(add try it online link)
Line 5,047:
gcd -47376 87843
# => 987</lang>
 
==={{header|dash or bash}}===
Recursive :
<lang bash>
gcd () { if [ "$2" -ne 0 ];then gcd "$2" "$(($1 % $2))";else echo "$1";fi }
 
gcd 100 75
# => 25</lang>
 
 
==={{header|C Shell}}===
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.