first script for bc
This commit is contained in:
parent
63bb0b961d
commit
942ed082f8
18
312/notes/math.bc
Normal file
18
312/notes/math.bc
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# What is this?
|
||||||
|
# Compilation of scripts to written for bc since bc is:
|
||||||
|
# a. literally a calculator
|
||||||
|
# b. code is pretty dang readable and useful
|
||||||
|
|
||||||
|
# Simple GCD
|
||||||
|
define gcd(a,b) {
|
||||||
|
while(a != b) {
|
||||||
|
if(a>b) {
|
||||||
|
a = a - b;
|
||||||
|
}
|
||||||
|
if(b>a) {
|
||||||
|
b = b - a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user