Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int PZ(string nr)
- {
- int pz = 0;
- for (int i = 0; i < nr.Length; i++)
- {
- int stelle = (int)(nr[i] - '0');
- stelle = (i % 2 == 0 ? stelle : stelle * 2);
- pz += stelle % 10 + (stelle >= 10 ? 1 : 0);
- }
- pz %= 10;
- return (10 - pz) < 10 ? 10 - pz : 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment