Just as Richard found, if I copy and paste your code verbatim into an online compiler -
OnlineGDB.com[
^] - and run it, then enter this text:
2 2
3 4
24 48
What do I get? "1", exactly the same as Richard.
So ... it's an initialization problem, or a compiler settings problem, or a 32 vs 64 bit machine problems, or ... anything really, that is different on your machine from those available to us.
Which means you need to debug the code on your machine, using the debugger to find out why you get 2 - and we can't do that for you because we don't get the same value as you! So grab your debugger and start looking at exactly what is happening in your code while it runs - it may be worth using your code on your machine in your debugger in parallel with the same code and inputs in the GDB debugger as that may make differences more apparent.
Good luck!