Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Apple Xcode
- #include <stdio.h>
- unsigned long the_fact(int the_number)
- {
- if (the_number > 1)
- {
- return the_number * the_fact(the_number - 1);
- }
- else
- {
- return 1;
- }
- }
- int main (int argc, const char * argv[])
- {
- // factorial
- int the_number = 0;
- int the_result;
- printf("Introduza um numero: ");
- scanf("%d", &the_number);
- the_result = the_fact(the_number);
- printf("%d! = %d", the_number, the_result);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement