119k views
1 vote
How can you predict whether the sum of two integers is 0, positive, or negative?

User Cem Mutlu
by
5.5k points

1 Answer

4 votes

Answer:

See explanation:

Explanation:

Let a and b be integers.

Sum means addition.

So we are trying to figure out what a+b equals.

It could result in as 0, negative, or positive.

a+b is 0 when a and b are of opposite values. Example: 5+(-5) or -5+5 is 0 because 5 and -5 are opposite values.

a+b is positive when both a and b are positive. Example 5+3=5.

a+b is positive when |a|>|b| and a is positive. Example: 5+(-3)=2 since |5|>|-3| and 5 is positive.

a+b is positive when |a|<|b| and b is positive. Example: -3+5=2 since |-3|<|5| and 5 is positive.

a+b is negative when both a and b are negative. Example: -5+(-3)=-8.

a+b is negative when |a|>|b| and a is negative. Example: -5+3=-2 since |-5|>|3| and -5 is negative.

a+b is negative when |a|<|b| and b is negative. Example: 3+(-5)=-2 since |3|<|-5| and -5 is negative.

User Oleh Rybalchenko
by
5.7k points