From 942ed082f867d128680359295ee759a0fca8851c Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 26 Sep 2019 11:18:58 -0700 Subject: [PATCH] first script for bc --- 312/notes/math.bc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 312/notes/math.bc diff --git a/312/notes/math.bc b/312/notes/math.bc new file mode 100644 index 0000000..c192761 --- /dev/null +++ b/312/notes/math.bc @@ -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; +} +