Math formula help

Hey Guys, I think something is wrong with this line of code. It works with most of the number that Ive tried. But when a = 1, b = 0, c = 9 it gives me -2147483648. The rest of my program works as I would expect. Also several other numbers into this formula works as expected.

int res = (10 * a + b) * pow (10, c);

This is the formula I'm trying to replicate
R=(10a+b)*10^c
1010 is greater than 231, so of course it won't fit in a 32-bit integer. Use a std::int64_t (long long) instead.
Topic archived. No new replies allowed.