0

How do i break a 5 Digit Zipcode so i can later add each digit together and get the check sum digit.

28th Feb 2018, 3:10 AM
Timew2
Timew2 - avatar
3 ответов
+ 2
Assuming you read the zipcode as an integer: int CheckSum(int zip) { int sum=0; while(zip!=0) { sum+=zip%10; zip/=10; } // To save the digits for later, assign // zip%10 inside array elements. return sum; }
28th Feb 2018, 3:29 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 1
Thank You. but I figured it . I'll post my code shortly
28th Feb 2018, 3:35 AM
Timew2
Timew2 - avatar