Either your teacher needs to be fired or instead of it being a sample code, you're supposed to fix all the errors to make it work. If the latter, you can start by defining c.
Having it in a loop definitely makes more sense. c is still undefined though and although I can safely assume it is of type char, no compiler will. Assigning it to each new character makes sense as well instead of only the first one as in your first post w/out the loop. It might just be because I'm tired, but I don't understand the conditions for the second if and it still look like a "fix the errors" exorcise. You need to step through it yourself, in your head, on paper, or with a debugger (defining c will get you started on that). If I fix it for you, you learn nothing and fixing code is what a programmer does most of the time.