Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1.  
  2.  
  3. void runLuhn (int *ccNum, int *checksum)
  4. {
  5. int i;
  6. int store;
  7. int total;
  8.  
  9. i = 0;
  10. store = 0;
  11. total = 0;
  12.  
  13.  
  14. for(i = 0; i < 16; i = i + 2)
  15. {
  16. ccNum[i] = ccNum[i] * 2;
  17. store = (ccNum[i] / 10) + (ccNum[i] % 10);
  18. ccNum[i] = store;
  19. }
  20. for(i = 0; i < MAXCCNUM-1; i++)
  21. {
  22. total = total + ccNum[i];
  23. }
  24.  
  25. printf("%d\n", total);
  26.  
  27. *checksum = total % 10;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement