12345678910
#include <iostream> int main(void) { const char arr[4] = { '1', '2', '9', '6' }; for(int i = 0; arr[i] != '\0'; ++i) { if(arr[i] >= '0' && arr[i] <= '4') std::cout << arr[i] << ' '; } return 0; }