mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
added a condition
If the user enters the input as 0 (zero) then also the output should be one
This commit is contained in:
parent
03a0e01950
commit
64c28f76a2
@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int fat(int number){
|
int fat(int number){
|
||||||
if (number == 1)
|
if (number == 1 || number == 0)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return number*fat(number-1);
|
return number*fat(number-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user