Skip to content

Instantly share code, notes, and snippets.

View LV's full-sized avatar
:shipit:
Siuuu

Luis Victoria LV

:shipit:
Siuuu
View GitHub Profile
@LV
LV / luhn.c
Last active February 13, 2020 22:40
Takes any digit number identifies if it is an AMEX number, VISA number, or if it's invalid using the Luhn (modulo 10) algorithm.
#include <cs50.h>
#include <math.h>
#include <stdio.h>
long long int cardNumber;
int cardDigits(long long int num);
int first2digits(long long int num);
int luhn(long long int card);
int main(void)