Add all the assignment code.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
58c6b1f81c
commit
cfe502c598
1277 changed files with 48709 additions and 1 deletions
26
hw6/oatprograms/gcd.oat
Normal file
26
hw6/oatprograms/gcd.oat
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
int gcd(int a, int b) {
|
||||
while (b != 0) {
|
||||
var t = b;
|
||||
b = mod(a, b);
|
||||
a = t;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int mod (int a, int b) {
|
||||
|
||||
var t = a;
|
||||
while (t - b >= 0) {
|
||||
t = t - b;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
int program (int argc, string[] argv) {
|
||||
var a = 64;
|
||||
var b = 48;
|
||||
|
||||
return gcd(a, b);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue