Need Help badly. pls tell my doubt

hello coders,

i have attempted this question which is very easy one and i got WA :frowning: … the given test cases passed in my compiler and all my code is correct … but i dont know y i am getting WA

Also, for evaluating the power i used modular exponentiation which is the best but still i got WA … pls yaar tell where i have done the mistake. In my code digit() function is for finding the number of digits of a given number.

Here is my solution
Thnq in advance.

your code is giving wrong answer on extreme conditions when n = 109.

you can see here.

since the nn will be very large in this case therefore the result will overflow the range of long long int. You have to use character array to calculate the powers and output the results.

@rjohari23:

so, i should use an array and write a separate muliplication function(not the normal multiplication but considering the carry and all those…?) for large integers?

refer here : http://www.cquestions.com/2011/07/c-program-to-find-power-of-large-number.html

how to calculate powers of large numbers using character array.