Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void overCiarovyKod(char *pole)
- {
- int celksuma = 0;
- int k, j, i;
- for(i = 1; i < 13; i++)
- {
- j = i % 2;
- if(j = 0)
- celksuma = celksuma + pole[i] - 48;
- else
- if((pole[i]) * 2 <= 10)
- celksuma = celksuma + (pole[i]) * 2;
- else
- celksuma = celksuma + ((pole[i]) * 2) - 9;
- }
- k = celksuma % 10;
- if(k != pole[14])
- {
- printf("FAIL\n");
- }
- else
- {
- printf("OK\n");
- }
- }
- int main()
- {
- char pole[] = "12391000105862";
- overCiarovyKod(pole);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement