Advertisement
anonymzz

Untitled

Apr 19th, 2023
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. // we can use char in switch statement because chars are ascii value.
  4.  
  5. int main(void)
  6. {
  7.     int goat_count;
  8.     // char c = 'b';
  9.  
  10.     printf("Enter a goat count: ");
  11.     scanf("%d", &goat_count);
  12.     // Read an integer from the keyboard
  13.  
  14.     // printf("%d\n", (int)c);
  15.  
  16.     switch (goat_count) {
  17.         case 0:
  18.             printf("You have no goats.\n");
  19.             break;
  20.         case 1:
  21.             printf("You have a singular goat.\n");
  22.             break;
  23.         case 2:
  24.             printf("You have a brace of goats.\n");
  25.             break;
  26.         default:
  27.             printf("You have a bona fide plethora of goats!\n");
  28.             break;
  29.     }
  30.  
  31.     printf("double");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement