1.c, the behaviour is undefined.
2, a for loop has the form for(initialization; condition; increment) ¿can you identify those parts in the code with the while?
3, notice that some cases don't have a break that'll make the code fall through. Consider that when converting to if-else, and don't worry about repeating code.