include using namespace std;
int main() { int num[10]; int i=0; while(num[i-1]!=42) { cin>>num[i]; i++;
} for(int j=0;j<i-1;j++) { cout<<num[j]; } return 0;
Where does it say there aren’t more than ten numbers? There could be eleven, a hundred, a million, or a bazillion numbers before the 42.
thanks,i got it.