-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcredit.c
74 lines (62 loc) · 1.43 KB
/
credit.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include<stdio.h>
#include<cs50.h>
#include<math.h>
int main(void)
{
long num ;
int digit = 0 , curent_digit = 0 , even_digit = 0 , odd_digit = 0 , total = 0 , even_digitx2 = 0;
int digit = 0, curent_digit = 0, even_digit = 0, odd_digit = 0, total = 0, even_digitx2 = 0;
bool its_even = false ;
//Prompt user card num
@@ -56,7 +56,7 @@ int main(void)
total = even_digit + odd_digit ;
if ( total % 10 == 0)
if (total % 10 == 0)
{
if(digit == 16)
{
if(MasterCard > 50 && MasterCard <56)
{
printf("MASTERCARD\n");
}
else if (Visa_16 == 4)
{
printf("VISA\n");
}
else
{
printf("INVALID\n");
}
}
else if(digit == 15)
{
if(AmExp == 34 || AmExp == 37)
{
printf("AMEX\n");
}
else
{
printf("INVALID\n");
}
}
else if(digit == 13)
{
if(Visa_13 == 4)
{
printf("VISA\n");
}
else
{
printf("INVALID\n");
}
}
else
{
printf("INVALID\n");
}
}
else
{
printf("INVALID\n");
}
}