See what problem says is you’ll be given inputs and you’ll have to Stop processing input after reading in the number 42,
So First Thing as it shows there are 5 inputs, it doesn’t mean that actual test cases will also consist of only 5 inputs, It may be something like
So you have to code considering all test cases satisfying the constraints should pass your code.
Now coming to Algorithm for this problem:
use an infinite loop
check if it is equal to 42,
if equal to 42:
And Thats it…!!
And remember to print ‘\n’ after printing the number, i.e.,
Enjoy Coding and Welcome to Codechef…