Use while loop to implement: Press ~ then Enter to stop - C Statement

C examples for Statement:while

Description

Use while loop to implement: Press ~ then Enter to stop

Demo Code

#include <stdio.h>
int main()//w ww . j a  v a 2  s  .co  m
{
   puts("Start typing.");
   puts("Press ~ then Enter to stop");
   while(getchar() != '~')
      ;
   printf("Thanks!\n");
   return(0);
}

Result


Related Tutorials