source: Deliverables/D4.1/GCC/EuclideanAlgorithm.c @ 165

Last change on this file since 165 was 165, checked in by mulligan, 9 years ago

Some example C programs that the emulator can run.

File size: 219 bytes
Line 
1#include "stdio.h"
2
3int gcd(int a, int b)
4{
5  if(b > a)
6    return gcd(b, a);
7  else if(b == 0)
8    return a;
9  else
10    return gcd(b, a % b);
11}
12
13int main()
14{
15  int a;
16  a = gcd(5, 15);
17  printf("%d", a);
18  return 0;
19}
Note: See TracBrowser for help on using the repository browser.