Hi Nikita,

Lets start understanding step by step

```
1! = 1
2! = 1!*2
2! = 2
3! = 2!*3
3! = 6
4! = 3!*4
4! = 24
```

We can turn this around:

```
4! = 24
3! = 4!/4
3! = 6
2! = 3!/3
2! = 2
1! = 2!/2
1! = 1
0! = 1!/1
0! = 1
```

If we try to extend this to -1, we find that (-1)! = 1/0 which means that (-1!) is undefined. Extending further to (-2)! etc. is thus impossible as well.
I would recommend you to execute the prog without the

**if (num < 0)** condition and pass

**-1** as parameter and check what is the result. This is an exciting way to learn and understand the programming.
Remember, if you are good in

*Maths* then its

*IMPOSSIBLE IMPOSSIBLE* to beat you as a programmer/developer.
I am working on my Mathematics again

Especially

*Discrete Mathematics* which is the backbone for a Software Engineer.
Hope this would be helpful.