/trunk/Examples/octave/contract/example.c
C | 23 lines | 15 code | 5 blank | 3 comment | 2 complexity | b4f27c8b431dd413d130768258723d91 MD5 | raw file
1/* File : example.c */ 2 3/* A global variable */ 4double Foo = 3.0; 5 6/* Compute the greatest common divisor of positive integers */ 7int gcd(int x, int y) { 8 int g; 9 g = y; 10 while (x > 0) { 11 g = x; 12 x = y % x; 13 y = g; 14 } 15 return g; 16} 17 18int fact(int n) { 19 if (n <= 0) return 1; 20 return n*fact(n-1); 21} 22 23