Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int a;
  7.     const char* m = "mezczyzna";
  8.     const char* k = "kobieta";
  9.     char plec[9];
  10.  
  11.     printf("Podaj wiek: ");
  12.     scanf("%i", &a);
  13.  
  14.     printf("Podaj plec: ");
  15.     scanf("%s", &plec);
  16.  
  17.     if (a >= 1 && a <= 3)
  18.     {
  19.         printf("1300");
  20.     }
  21.     else if (a >= 4 && a <= 6)
  22.     {
  23.         printf("1700");
  24.     }
  25.     else if (a >= 7 && a <= 9)
  26.     {
  27.         printf("2100");
  28.     }
  29.     else if (a >= 10 && a <= 12)
  30.     {
  31.         if (strcmp(plec, m) == 1)
  32.         {
  33.             printf("2600");
  34.         }
  35.         else
  36.         {
  37.             printf("2300");
  38.         }
  39.     }
  40.     else
  41.     {
  42.         printf("Incorrect input");
  43.  
  44.         return 1;
  45.     }
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement