I have a homework assignment in basic C that is asking me to calculate certain expressions and then check my answers in a program. I can't seem to get any of these answers correct by my own calculations...
They want me to solve math problems using these variables:
int a = 2;
double b = 4.7;
int c = 3;
double d = 4.2;
Here's an example question:
int answer1 = b+a/c-d;
I understand that since it has an int operand then all the variables convert to an integer, so it should look something like this I think:
(4+2)/(3-4)
I got -6 as my answer when doing it by hand, but when I input it as code it gives me an answer of 0. Can anyone explain this? Am I doing the order of operations wrong? I simply don't understand how the computer gets 0 out of that. This is the easiest question in my homework and I don't have a clue. Please help!