I suspect that this is because you are tyring to print a standard int
value with %ld
, the formatting marker for long int
. I you need values greater than 2 billion, then you need to declare the variables as long
or even long long
(depending) as well.
BTW, has this assignment been handed in yet? It's been over a week.