Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.         char likes_digging_for_treasure, can_swim;
  6.  
  7.         printf ("Do you like digging for treasure? (y/n).\n");
  8.         scanf ("%c", &likes_digging_for_treasure);
  9.  
  10.         if (likes_digging_for_treasure == 'n' || likes_digging_for_treasure == 'N')
  11.         {
  12.                 printf("You can't join the crew.\n");
  13.         }
  14.  
  15.                 if (likes_digging_for_treasure == 'y' || likes_digging_for_treasure == 'Y')
  16.                 {
  17.                         printf("Good.\n");
  18.                         printf ("Can you swim? (y/n).\n");
  19.                         scanf (" %c", &can_swim);
  20.                 }
  21.  
  22.         else
  23.         {
  24.                 printf("Your input was invalid\n");
  25.         }
  26.  
  27.         return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement