06.02.2016, 18:54
have you checked the value of "amount2"? 
before if(amount2 <= 2) would be nice..
The code looks fine although on the first glance, so maybe the simpliest answer could be right on this one

Код:
printf("amount2 has %d", amount2);
The code looks fine although on the first glance, so maybe the simpliest answer could be right on this one