commit 943dcb38a71ac8589bee1be30466b76b3bc73048 parent 258e2938857ca97bc1aac380901c4888aa0fc20a Author: Martin J. Klöckner <martin.cachari@gmail.com> Date: Wed, 2 Dec 2020 00:05:17 -0300 Added guia05/ex01.c Diffstat:
A | 95.11/guia05/ex01.c | | | 22 | ++++++++++++++++++++++ |
1 file changed, 22 insertions(+), 0 deletions(-) diff --git a/95.11/guia05/ex01.c b/95.11/guia05/ex01.c @@ -0,0 +1,22 @@ +#include <stdio.h> + +unsigned long fact (int num); + +int main ( void ) { + + printf("%lu\n", fact(5)); + + return 0; +} + +unsigned long fact (int num) { + unsigned long j, res; + res = 1; + + for (j = 1; j <= num; j++) { + res = (res * j); + } + + return res; +} +