Mega Code Archive

 
Categories / C / Code Snippets
 

Do while loop

#include <stdio.h> #include <ctype.h> int main(void) { char mych; printf("Enter some text (type a period to quit).\n"); do { mych = getchar(); if(islower(mych)) mych = toupper(mych); else mych = tolower(mych); putchar(mych); } while (mych != '.'); return 0; }