I´m seeing arithmetic results that are baffling me.

In my header file, I declare the following:

In my code, I have an attribute to count the number of children served with apples:Code:#define MAX_CHILDREN 200 #define APPLES_PER_CHILD 25

In my tests, number of children served is coming in with the value of 1. But I get strange results from the following printfs:Code:long children_served;

The first three printouts are as expected. But the last one is coming in with the wrong value!! It shows 619, while it should be 4975!Code:printf("The maximum number of children served is %d\n", MAX_CHILDREN); printf("Apples served per child: %d\n", APPLES_PER_CHILD); printf("Number of children unserved: %ld\n", (MAX_CHILDREN - children_served)); printf("Number of apples needed to serve unserved children: %ld\n", (MAX_CHILDREN - children_served) * APPLES_PER_CHILD);

Any ideas what´s going on here? ANd yes, I´ve tried casting, since that´s the only thing I thought could be wrong with the code.Code:The maximum number of children served is 200 Apples served per child: 25 Number of children unserved: 199 Number of apples needed to serve unserved children: 619

Thanks