28th May 2022, 3:30 PM
Mouadh Bouziane
Mouadh Bouziane - avatar
3 Réponses
+ 4
Mouadh Bouziane You can understand like this also: 5 - fact(4) = 5 - (4 - fact(3)) = 5 - (4 - (3 - fact(2))) = 5 - (4 - (3 - (2 - fact(1)))) = 5 - (4 - (3 - (2 - (1 - fact(0))))) = 5 - (4 - (3 - (2 - (1 - 0)))) = 5 - (4 - (3 - (2 - 1))) = 5 - (4 - (3 - 1)) = 5 - (4 - 2) = 5 - 2 = 3
28th May 2022, 4:36 PM
A͢J
A͢J - avatar
+ 3
fact(5) 5 - fact(4) 4 - fact(3) 3 - fact(2) 2 - fact(1) 1 - fact(0) fact(0) returns 0 1 - 0 -> returns 1 2 - 1 -> returns 1 3 - 1 -> returns 2 4 - 2 -> returns 2 5 - 2 -> returns 3 So fact(5) = 3 Hope this helps.
28th May 2022, 3:46 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
thanks
28th May 2022, 3:47 PM
Mouadh Bouziane
Mouadh Bouziane - avatar