why output is showing 0 ?
Modular Exponentiation
The value of c in your test case is 1.
In line 11, x = x%c sets the value of x to 0.
And in the while loop, the value of ans is set to 0.
So the output is 0.
why output is showing 0 ?
The value of c in your test case is 1.
In line 11, x = x%c sets the value of x to 0.
And in the while loop, the value of ans is set to 0.
So the output is 0.