Tuesday, 29 September 2015

C Program to use of getchar function



/*C Program to use of getchar() function*/
#include<stdio.h>
main()
{
      char ans;

      printf("Would you like to study");
      printf("\n Enter 'y' for yes and 'n' for no\n");
      ans=getchar();
      if(ans=='y'||ans==’Y’)
      {
           printf("Go to study Room.....");
      }
      else
      {
           printf("Go to play ground.....");
      }
}
 

No comments:

Post a Comment