C examples for Statement:if
suppose the input is as follows.
q c h b
#include <stdio.h> int main(void) { char ch; //from w w w.j a v a2 s .co m while ((ch = getchar()) != '#') { if (ch == '\n') continue; printf("Step 1\n"); if (ch == 'c') continue; else if (ch == 'b') break; else if (ch == 'h') goto laststep; printf("Step 2\n"); laststep: printf("Step 3\n"); } printf("Done\n"); return 0; }