PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/tcl/contract/example.c

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