sirbi

Untitled

Dec 2nd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.41 KB | None | 0 0
  1. //ввод библиотек
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <locale.h>
  5. //ввод переменных
  6. double sum;                   //Сумма покупки в руб.
  7. double discout_sum;           //Сумма скидки в руб.
  8. double discout_price;         //Цена со скидкой в руб.
  9. double discount_perc;         //Размер скидки в %
  10. int sizediscount;             //???
  11. //тело программы
  12. int main()
  13. {
  14.     //Русский язык
  15.     setlocale(LC_ALL, "rus");
  16.     //3 задание
  17.     printf("3 задание \n");
  18.     printf("\n");
  19.     printf("\n");
  20.     printf("Введите сумму покупки: \n");
  21.     scanf_s("%f \n", &sum);
  22.     printf("\n");
  23.     printf("\n");
  24.     switch (sizediscount)
  25.     {
  26.     case 1:
  27.         if ((sum > 500 && sum <= 1000))
  28.         {
  29.             discount_perc = 3;
  30.             break;
  31.         }
  32.     case 2:
  33.         if ((sum > 1000 && sum <= 1500))
  34.         {
  35.             discount_perc = 5;
  36.             break;
  37.         }
  38.     case 3:
  39.         if (sum > 1500)
  40.         {
  41.             discount_perc = 8;
  42.             break;
  43.         }
  44.     case 4:
  45.         if (sum <= 500)
  46.         {
  47.             discount_perc = 0;
  48.             break;
  49.         }
  50.     }
  51.     //функции
  52.     discout_price = ( discount_perc / 100 ) * sum;
  53.  
  54.     printf("Ваша скидка: %8.2f \n", &discount_perc);
  55.     printf("Ваша сумма скидки: %f\n", &discout_sum);
  56. printf("Ваша сумма покупки со скидкой: \n", &discout_price);
  57. printf("Завершение работы ...\n");
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment