My code works fully but for full credit we need to include a comma after every number except the last one. I'm not sure where I should place it seeing as where ever it ends up either in the for loop or out, it does not produce the correct look.
My code produces 25 0 33 like it should be needs to look like 25, 0, 33
Sample inputs: 5 25 51 0 200 33 0 50
#include <stdio.h>
int main() {
int numVals;
int max, min;
printf("How many integers to enter?\n");
scanf("%d", &numVals);
int array[numVals];
printf("Please enter %d integers: \n", numVals);
for (int i = 0; i < numVals; ++i) {
scanf("%d", &array[i]);
}
printf("Lower and upper bounds: \n");
scanf("%d %d", max, min);
for (i = 0; i < numVals; ++i) {
if (array[i] >= min && arr[i] <= max {
printf("%d", array[i]);
}
}
return 0;
}
"., "if that's not true.printf (i>0?", %d":"%d", array[i]);By setting thei>0condition, branch prediction will minimize the impact of the conditional only taking thefalsepath of the ternary on the first iteration.