I tried to express 10 power 10 but it didn't work, so I thought the problem is the range of the data type.
Finally I changed the type from int to __int64
but it isn't yet working.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int a, r, n;
__int64 d;
cin >> a; // a=10
cin >> r; // r=10
cin >> n; // n=10
d = a * pow (r, n - 1);
cout << int(d);
}
My expected answer is 10000000000 but result of the operation is 1410065408
What's the problem?