Please find the error in the program!

Here’s the link : My Solution

Change the statement

```
ans = ans*(N-i)/((i+1)/x);
```

to

`ans = ans*((N-i)/((i+1)/x));`

1 Like

Thanks, it helped… But, how did that bracket make the difference?

In your statement, ans*(N-i) is calculated first over division. This changes the value you are calculating(nCr). So placing a parenthesis such that division takes place before multiplication solved the problem.