I have sat down and worked out my pseudo code and I'm still having difficulties In this activity. I just don't know if I am just not translating what I think into code and I'm not sure how to get the beginning numbers. Maybe I'm going at this totally wrong. I just don't want to spend hours on the wrong code.
#include <cs50.h>
#include <stdio.h>
int main(void)
{
long long lastnum = 0;
int x = 0;
int y = 0;
int z = 0;
int multinum = 0;
icount = 0;
bnumb = 0;
do
{
printf ("Credit Card Number ");
long long cardn = get_long_long();
}
while (cardn >= 0);
{
//get last number
(lastnum = cardn % 10);
(x = lastnum + x);
(icount++);
//get second to last number
(cardn = cardn/10);
(multinum = cardn % 10);
(y = multinum * 2);
(icount++);
//get number for ending in zero
(z = y + z);
}
If (bnumb = 34 || 37) and (icount = 15)
{
printf("AMEX\n", cardn);
}
If (bnumb = 51 || 52 || 53 || 54 ||55) and (icount = 16)
{
printf("MASTERCARD\n");
}
If (bnumb = 4) and (icount = 13 || 16)
{
printf("VISA\n");
}
else
{
printf("INVALID\n")
}
return 0;
}