jeudi 22 août 2019

Find 2 Chars that when added together are within the bounds of 60 and 63 inclusive

I have a list which the length must be equal to 2. The addition of the two characters must be between decimal 60 and 63.

i ve tried using NUL and = which is 61 but c doesnt recognise NUL as a char?

char list[] = {'=','\0'};

if (list.length != 2){
    printf("fail");
}

if (list[0] + list[1] ) { // between 60 and 63 inclusive check 

    printf("pass");
}

Need two things or trick it to get it to be in the range and satisfy the length as well.

Aucun commentaire:

Enregistrer un commentaire