# Something wrong with my credit.c code

I tried writing code for cs50 pset1's problem: credit.c(more comfortable) after week2. My code is given below. The problem is that 'sumx' and 'sumy' are just 0 and hence 'sum' is always equal to 0. So whenever I give a correct credit card number, it is just going to new line and program ends. How can I solve this problem and why are 'sumx' and 'sumy' not adding up to their respective sums as they should according to the algorithm?

My code is:

``````#include <cs50.h>
#include <stdio.h>

int main(void){

long long i;
do{
i = get_long_long();
}
while(i < 4e12 || i > 5.5e15);
int count = 0;
int n;
long long c = i;

while(i != 0){
n = i%10;
i = i/10;
count++;
}
int x[count];

for(int j = 0; j < count; j++){
x[j] = c%10;
i = c/10;
}

int sumx = 0;

for(int j = 0; j < count - 1; j += 2){
x[j] = x[j] * 2;
sumx = sumx + x[j];
printf("%i", sumx);
}

int sumy = 0;

for(int j = 0; j < count; j += 2){
sumy = sumy + x[j];
}

int sum;
sum = sumx + sumy;

if(sum%10 == 0){
if((count == 15 && x == 3) && (x == 4 || x == 7)){
printf("AmEx\n");
}
else if((count == 16 && x == 5) && (x > 1 || x < 5)){
printf("MASTERCARD\n");
}
else if((count == 13 && x == 4) || (count == 16 && x == 4)){
printf("VISA\n");
}
}
else{
printf("Invalid Number\n");
}

return 0;
}
``````