In language C
For any element in keysList with a value smaller than 50, print the corresponding value in itemsList, followed by a comma (no spaces).
Ex: If the input is:
32 105 101 35
10 20 30 40
the output is:
10,40,
I have the code but I am missing the coma between the numbers. For my input of "25 13 92 41 37 68 50 15" My output is "3768," but I need it to be "37,68,"
#include
int main(void) {
const int SIZE_LIST = 4;
int keysList[SIZE_LIST];
int itemsList[SIZE_LIST];
int i;
scanf("%d", &keysList[0]);
scanf("%d", &keysList[1]);
scanf("%d", &keysList[2]);
scanf("%d", &keysList[3]);
scanf("%d", &itemsList[0]);
scanf("%d", &itemsList[1]);
scanf("%d", &itemsList[2]);
scanf("%d", &itemsList[3]);
for(i=0; i if(keysList[i] <=40)
printf("%d", itemsList[i]);
printf(",");
printf("\n");
return 0;
}