## Math and Comparison Operators Comments

• #### Jay Learn

I solved this problem with first declaring sum and mul as integers. Then returning their values using modulus.

• #### Ryan

the question confused me, when did i have to multiply at any point???

• #### Learneroo

@Ryan, the product of `a` and `b` means multiply `a` by `b`. Would this be clearer:

Multiply `a` by `b` and then get the remainder from dividing that product by the sum of `a` and `b` ?

• #### Ryan

Yeah, thank you. The product made me think addition but i guess that would be the sum. Maybe i should have taken more math classes lol. So far this has been the best teaching program i have used

• #### Brent Jones

Excellent tutorial thus far. It is probably hard to understand the precise syntax that is needed to pose the problems.

• #### Denis Semendyayev

i was so confused by the wording of product. to me it processed as the same thing as sum :/

• #### Gandalf The Fabulous

Gandalf the Fabulous approves of this.

• #### Bilbo Swaggins

Bilbo Swaggins likes this

• #### Matt

I read the challenge about 5 times and operated exactly what they wrote: return (a*b)%(a+b);

I hope this helps. Wording can be tricky but it's all going back to basic math terminology.

• The remainder of 5 % 3 could have been -1 too.

• #### ArtTric

This one tripped me too. It can be done this way as well:
int product = a * b;
int sum = a + b;
return product % sum;

• #### Mitchell

PEMDAS is also known as BEDMAS (brackets instead of parentheses)

• #### thales

I am a math teacher so this wasnt to hard for me :-)

• #### Joseph Estridge

I have a question... I understand that you can just return the value of "(a * b) % (a + b);" ... But I also tried doing this one by assigning to value to a new variable, int C. I added an int

• #### Eze Sunday Eze

i got confused, i got it when i read the question again.

• Good way of learning..

• #### Shandeep Kumar

that's really awsome man

• #### Roberto Blanco Axelsson

My solutions was like ArtTric

• #### Enoch

I don't know where to input int product = a*b;
Int sum = a+b;

• #### paul. kirsch

I got it correct after 3 tries. I may be wrong but I surmise that '%'is to be put between code that identifies what variables you are working with such as 'sum' and really means: "divide and also give me the remainder".

• #### hunter

yeeyee

• #### Kurt

something is wrong here because how is 5*1 divided by (5+1) have a remainder of 5?

basic math says its .8 with a remainder of 2. so 5*1 is 5. well 5 divided by 6 equals 0.8 r2

• #### Kurt

I get the code, but it has a flaw because 5*1 divided by 6 does not have a remainder of 5. its 2

because basic math says that 5/6 is 0.8 with a remainder of 2.

• #### lucifer

guys i did this
//int num
//(1*5)%(6);
return (a*b)%(a+b)

• #### noel

int mul = a * b;
int sum = a+b;
int result = mul%sum;
return result;

• #### Santo Credendino

What is going on in this solution:
Applying the rules for Math and Operator Order of Precedence
1. addition is performed first because of ( )
2. multiplication is the next operation

• #### Raj

it can be also done by this:
int product = a+b;
return (a*b)%product;
// product is the sum of A and B, i could have named it anything//