INTEGERS PART 2

How to add 2 integers?

Important note:

1.NO     2.NO    operation
(+)      +   (+)     = (+)
(-)       +   (+)     = (-)
(-)       +   (-)      = (+)

Example 1(both positive):

1+1

(Add both the numbers)

Solution:

 01
 01
____
 02

Example 2(one with negative):

(-1) + 2

(Subract the numbers because one number is negative and put the greater number sign in the answer.

Solution:
 -01
+02     (bigger number)
______
+01  (bigger number sign)

Example 3(both negative):

(-1) + (-1)

Solution:
(Add both the numbers because both are negative)

-01
-01
_____
-02

Tips:

If both numbers are negative or positive,just add the both numbers and put the positive sign for problems having both positive sign and put negative sign for problems having both negative sign.

If one number is negative and one number is positive,then just subract those numbers and put the greater number sign


Comments

Popular posts from this blog

LCD Characters

How to connect Bluetooth controller to motor driver?

Bluetooth controlled 16*2 LCD display with Arduino