Compiler Design 2023
Testcase “euclid” of Assignment 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Euclid's algorithm to compute the greatest
// common divisor of two integers:
int gcd(int a, int b) {
while (b != 0) {
if (a > b) {
a = a - b;
} else {
b = b - a;
}
}
return a;
}
int main () {
int result;
result = gcd(22,12);
putInt(result);
putLn();
}