Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. My numbers are 23 and 45. M I Ai Bi Carry Ci
  2. Step 1: Set Carry equal to 0 2 0
  3. Step 2: Set i equal to 0 2 0 3 5 0
  4. Step 3: For each i less than or equal to m - 1, repeat steps 4-6 2 0 3 5 0
  5. Step 4: Add the two digits ai and bi to the current value of carry to get ci 2 0 3 5 0 8
  6. Step 5: If ci is greater than or equal to 10 reset ci to ( ci - 10 ) 2 0 3 5 0 8
  7. and reset the value of carry to 1 otherwise set the new value of carry to 0
  8. Step 6: Add 1 to the value of i 2 1 2 4 0 0
  9. Step 4: Add Ai and Bi to carry to get Ci 2 1 2 4 0 6
  10. Step 5: If Ci is greater than or equal to 10 reset Ci to (Ci-10) 2 1 2 4 0 6
  11. and reset the value of carry to 1 otherwise set the new value of carry to 0
  12. Step 6: Add 1 to the value of 1 2 2 0 0 0 0
  13. Step 7: Set the value of cm to the value of carry 2 2 0 0 0 0
  14. Step 8: Print out the value of Cm, Cm-1, Cm-2...C0 2 2 0 0 0 0
  15. Step 9: Stop
  16. Final answer: 23 + 45 = 68
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement