Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ввод библиотек
- #include <stdio.h>
- #include <math.h>
- #include <locale.h>
- //ввод переменных
- double sum; //Сумма покупки в руб.
- double discout_sum; //Сумма скидки в руб.
- double discout_price; //Цена со скидкой в руб.
- double discount_perc; //Размер скидки в %
- int sizediscount; //???
- //тело программы
- int main()
- {
- //Русский язык
- setlocale(LC_ALL, "rus");
- //3 задание
- printf("3 задание \n");
- printf("\n");
- printf("\n");
- printf("Введите сумму покупки: \n");
- scanf_s("%f \n", &sum);
- printf("\n");
- printf("\n");
- switch (sizediscount)
- {
- case 1:
- if ((sum > 500 && sum <= 1000))
- {
- discount_perc = 3;
- break;
- }
- case 2:
- if ((sum > 1000 && sum <= 1500))
- {
- discount_perc = 5;
- break;
- }
- case 3:
- if (sum > 1500)
- {
- discount_perc = 8;
- break;
- }
- case 4:
- if (sum <= 500)
- {
- discount_perc = 0;
- break;
- }
- }
- //функции
- discout_price = ( discount_perc / 100 ) * sum;
- printf("Ваша скидка: %8.2f \n", &discount_perc);
- printf("Ваша сумма скидки: %f\n", &discout_sum);
- printf("Ваша сумма покупки со скидкой: \n", &discout_price);
- printf("Завершение работы ...\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment