Merge pull request #1 from viditkulshreshtha/viditkulshreshtha-patch-1

added another condition
This commit is contained in:
viditkulshreshtha 2017-11-02 14:52:31 +05:30 committed by GitHub
commit 52ac66d065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}
}