mirror of https://github.com/TheAlgorithms/C
Merge pull request #1 from viditkulshreshtha/viditkulshreshtha-patch-1
added another condition
This commit is contained in:
commit
52ac66d065
|
@ -1,7 +1,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int fat(int number){
|
||||
if (number == 1)
|
||||
if (number == 1 || number == 0)
|
||||
return 1;
|
||||
else
|
||||
return number*fat(number-1);
|
||||
|
@ -17,4 +17,4 @@ int main(){
|
|||
printf("%d\n", fat(number));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue