What could be the problem with this code?I am getting wrong answer for this code.
using namespace std;
int main() {
int i, num[5]; for(i=0; i<5; ++i) { cin>>num[i]; } for(i=0; i<5 && num[i]!=42; ++i) { cout<<num[i]<<endl; } return 0;
}
Hi sarvesh,
i think you didn't understand the question.question says you have to process till 42 appears
for ex:-input:-12 898756789102598742364214782364
o/p:-12 89875678910259874236