Sample input problem

Here, in this question’s answer
what is the meaning of while(1) and there is also if loop is present but loop isn’t closed beak statement is used
my doubt is hoe this loop is used without else and closing bracket

while(1)

this means condition is always true (1)
this loop run infinitely unless you use break inside loop

if is not a loop

if is a conditional statement (used to check condition)