STEAM GROUP
Skull&Bones//322 SB322
STEAM GROUP
Skull&Bones//322 SB322
0
IN-GAME
0
ONLINE
Founded
15 February, 2015
Language
English
ABOUT Skull&Bones//322

Singapore?

Business school? #include <stdlib.h> // für atoi
#include <string.h> // für strlen

bool checkLuhn(const char *pPurported)
{
int nSum = 0;
int nDigits = strlen(pPurported);
int nParity = (nDigits-1) % 2;
char cDigit[2] = "\0\0"; // atoi erwartet einen null-terminierten String
for (int i = nDigits; i > 0 ; i--)
{
cDigit[0] = pPurported[i-1];
int nDigit = atoi(cDigit);

if (nParity == i % 2)
nDigit = nDigit * 2;

nSum += nDigit/10;
nSum += nDigit%10;
}
return 0 == nSum % 10;
POPULAR DISCUSSIONS
VIEW ALL (5)
GROUP MEMBERS
Administrators
Members