Hi all
I am new in C++ and I just learning something
I am stuck on some operation math, I just learning from local website that provide problems question to solve.
Problem want to program to input a b c d and write the output a^b^c^d mod 101
for example:
the example input is 2 3 2 3 and then give output is 73. Input was a b c d, where a = 2, b = 3, c =2 and d = 3.
I calculate it from calculator and I got correct answer from calculator:
c ^ d = 2 ^ 3 = 8
b ^ 8 = 3 ^ 8 = 6561
a ^ 6561 = 2 ^ 6561 = 1,1423562217377937432834817564864e+1975
and then 1,1423562217377937432834817564864e+1975 mod 101 = 73
the problem is, 1,1423562217377937432834817564864e+1975 always give me 1.#INF, I already use long double and it still giving me 1.#INF. It seem overflow..
is there another way to solve this? another datatype? or anything else?