Upcoming SlideShare
×

581 views
449 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
581
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
6
0
Likes
0
Embeds 0
No embeds

No notes for slide

1. 1. Algorithms for Integer Arithmetic Addition Algorithm
2. 2. Three Steps to Adding Two Integers STEP 1. Do they have the same sign ? (both positive or both negative) or Do they have opposite signs ? (one positive and the other negative)
3. 3. Same Signs STEP 3. Now enter the sum of the absolute values: (add the magnitudes) STEP 2. Enter the common sign:
4. 4. Opposite Signs STEP 3. Enter the difference of the larger magnitude and the smaller: STEP 2. Enter the sign of the number having the larger magnitude:
5. 5. Work it out!
6. 6. Step 1 They have opposite signs. Same or opposite signs?
7. 7. Step 2 Enter the sign of the number having the larger magnitude: |-34| = 34 > 12 = |12|
8. 8. Step 3 Subtract the smaller magnitude from the larger and enter the result.
9. 9. Work it out!
10. 10. Step 1 They have opposite signs. Same or opposite signs?
11. 11. Step 2 Enter the sign of the number having the larger magnitude: |29| = 29 > 14 = |-14|
12. 12. Step 3 Subtract the smaller magnitude from the larger and enter the result.
13. 13. Work it out!
14. 14. Step 1 They are both positive. Same or opposite signs?
15. 15. Step 2 The sign is positive.
16. 16. Step 3 Add the magnitudes and enter the result.
17. 17. Work it out!
18. 18. Step 1 They are both negative. Same or opposite signs?
19. 19. Step 2 The sign is negative.
20. 20. Step 3 Add the magnitudes and enter the result.
21. 21. Adding Many Integers 1. Add all the positive numbers and add all the negative numbers: 2. Add the two signed numbers:
22. 22. Work it out!
23. 23. Work it out!
24. 24. Work it out!
25. 25. Work it out!
26. 26. Work it out!
27. 27. Work it out!
28. 28. Work it out!
29. 29. Work it out!
30. 30. Work it out!
31. 31. Work it out!
32. 32. Work it out!
33. 33. Work it out!
34. 34. Work it out!
35. 35. Work it out!
36. 36. Work it out!
37. 37. Work it out!
38. 38. Work it out! Rigid use of an algorithm is not always best.
39. 39. Work it out!
40. 40. Work it out!
41. 41. Moral Look before you leap! Many problems can be worked in your head if you do things in the right order.