mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 13:31:21 +03:00
20 lines
268 B
C
20 lines
268 B
C
#include <stdio.h>
|
|
|
|
int fat(int number){
|
|
if (number == 1)
|
|
return 1;
|
|
else
|
|
return number*fat(number-1);
|
|
}
|
|
|
|
int main(){
|
|
int number;
|
|
|
|
//Asks the factorial of the number n
|
|
printf("Number: ");
|
|
scanf("%d", &number);
|
|
|
|
printf("%d\n", fat(number));
|
|
|
|
return 0;
|
|
} |