9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia05/ex01.c (251B)
   1 #include <stdio.h>
   2 
   3 unsigned long fact(int num) {
   4     unsigned long j, res;
   5     res = 1;
   6 
   7     for (j = 1; j <= num; j++) {
   8         res = (res * j);
   9     }
  10     return res;
  11 }
  12 
  13 int main ( void ) {
  14 
  15     printf("%lu\n", fact(5));
  16     printf("%lu\n", fact_recursive(5));
  17 
  18     return 0;
  19 }