Well I only see one loop...
First you request and obtain some values. This code is not in a loop and will only happen one time. Then we encounter
while (int k=1) which is an infinite loop. It will never stop. That is sometimes ok, but probably not a great idea here. Normally a while loop would have braces to show the statements it is controlling. You have no braces, that is legal, so only one statement is controlled by your infinite loop. It is a lengthy if statement with many "else if" causes.
I guess one of the tests tested true. For each test you output something and then call exit(). A call to exit() terminates the program. So if you see any output, we expect the program to hit exit() and well, exit.
Suppose none of the tests were true. Then your infinite loop would run the same tests on the same data. If none of the tests were true the first time, they will still not be true the second time. Or the third time. Or the fourth time.... This is not a good thing.
Your infinite loop will never finish. But if it did, you would execute your "return" statement. Returning from main() is legal and will also terminate the program. Right now you can't reach that return statement.
Fair warning, I'm tired and I just glanced at your code. I haven't tried it. I could be wrong. But I don't think so. Good night... going to bed.