Guest User

Untitled

a guest
Oct 20th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. /* Написати програму обчислення вартості покупки з урахуванням знижки.
  2. Знижка в 3% надається в тому випадку, якщо сума покупки більше 500 грн.,
  3. в 5% - якщо сума більше 1000 грн. */
  4.  
  5.  
  6. //Обчислення вартості покупки з урахуванням знижки//
  7.  
  8. #include <stdio.h>
  9. #include <conio.h>
  10. #include <stdlib.h>
  11.  
  12. int main()
  13. {
  14. system("chcp 1251");
  15.  
  16. double price, discount;
  17.  
  18. printf("\n Введіть суму покупки -> ");
  19. scanf("%f", &price);
  20.  
  21. printf("\n Вам надається знижка: ");
  22. if(price >= 500 && price < 1000)
  23. {
  24. discount = 3;
  25. printf("discount = %f", discount);
  26. }
  27. else if (price >= 1000 )
  28. {
  29. discount = 5;
  30. printf("discount = %f", discount);
  31. }
  32. else
  33. {
  34. discount = 0;
  35. printf("discount = %f", discount);
  36. }
  37.  
  38. printf("\n Вартість покупки з урахуванням знижки = ", price - ( price * (discount / 100)));
  39.  
  40. getch();
  41. return 0;
  42. }
Add Comment
Please, Sign In to add comment