0
Loops
How could I edit my code Using a while loop and two if statements to not print number less than 5 and numbers greater than 10 in the array? https://code.sololearn.com/ciGpJ07RJVEd/?ref=app
2 Answers
+ 2
#include <stdio.h>
int main() {
int array[] = {1, 7, 4, 5, 9, 3, 5, 11, 6, 3, 4};
int i = 0;
int arraysize = 11;
while (i < arraysize) {
if (array[i] < 5) {
i++;
continue;
}
if (array[i] > 10) {
i++;
continue;
}
printf("%d\n", array[i]);
i++;
}
return 0;
}
+ 1
Thanks for help, i knew i was doing something wrong but wasnt sure.đ