projects
/
libfirm
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
generate real fprem node
[libfirm]
/
ir
/
be
/
test
/
gcd.c
1
#include <stdio.h>
2
3
int gcd(int a, int b)
4
{
5
int i = 0;
6
7
while(a != b)
8
{
9
if(a > b) {
10
a = a - b;
11
}
12
else {
13
b = b - a;
14
}
15
++i;
16
}
17
return a;
18
}
19
20
int main(int argc, char** argv)
21
{
22
int a = 49, b = 35, i, g;
23
24
if(argc > 2) {
25
a = atoi(argv[1]);
26
b = atoi(argv[2]);
27
}
28
29
printf("gcd.c\n");
30
31
for (i = 0; i < 100000; i++) {
32
g = gcd(a, b);
33
}
34
35
printf(" GCD of %d and %d is %d\n", a, b, g);
36
37
return 0;
38
}