HristoBaychev

6shop

Oct 5th, 2021 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.47 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. float tomato = 0;
  6. float flour = 0;
  7. float candy = 0;
  8.  
  9. const float tomatoPricePerKilo = 4.50;
  10. const float flourPricePerKilo = 1.80;
  11. const float candyPricePerKilo = 1.50;
  12.  
  13. float tomatoWeigth = 0;
  14. float flourWeight = 0;
  15. float candyWeight = 0;
  16.  
  17.  
  18.  
  19. float yogurt = 0;
  20. float iceCream = 0;
  21. float lolipoop = 0;
  22.  
  23. const float yogurtPrice = 0.50;
  24. const float iceCreamPrice = 0.60;
  25. const float lolipoopPrice = 0.15;
  26.  
  27. int yogurtPerPcs = 0;
  28. int iceCreamPerPcs = 0;
  29. int lolipopPerPcs = 0;
  30.  
  31. float sumForTomato = 0;
  32. float sumForFlour = 0;
  33. float sumForCandy = 0;
  34. float sumForYogurt = 0;
  35. float sumForIceCream = 0;
  36. float sumForLoliPop = 0;
  37.  
  38.  
  39. float totalSumOfAllProductsIs = 0;
  40.  
  41.  
  42. printf("\nIf want tomato press 1 for no 0");
  43. printf("\n Please, make your choice: ");
  44. scanf("%f", &tomato);
  45. if (tomato == 1){
  46. printf("\nHow many kilograms do you want:");
  47. printf("\n Please, make your choice: ");
  48. scanf("%f", &tomatoWeigth);
  49. sumForTomato = tomatoWeigth * tomatoPricePerKilo;
  50. printf("\nThe price for this product is : %.2f BGN ", sumForTomato);
  51. printf("\n");
  52. printf("\n");
  53. }
  54. else if (tomato == 0){
  55.     printf("Thanks, Your bill for this product is : %.2f BGN", sumForTomato);
  56.     printf("\n");
  57.     printf("\n");
  58. }
  59. else if (tomato > 1){
  60.     printf("Enter correct value");
  61.     printf("\n");
  62.     printf("\n");
  63. }
  64.  
  65.  
  66. printf("\nIf want flour press 1 for no 0");
  67. printf("\n Please, make your choice: ");
  68. scanf("%f", &flour);
  69. if (flour == 1){
  70. printf("\nHow many kilograms do you want:");
  71. printf("\n Please, make your choice: ");
  72. scanf("%f", &flourWeight);
  73. sumForFlour = flourPricePerKilo * flourWeight;
  74. printf("\nThe price for this product is : %.2f BGN ", sumForFlour);
  75. printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour);
  76. printf("\n");
  77. printf("\n");
  78. }
  79. else if (flour == 0){
  80.     printf("Thanks, Your  bill for this product is : %.2f BGN", sumForFlour);
  81.     printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour);
  82.     printf("\n");
  83.     printf("\n");
  84. }
  85. else if (flour > 1){
  86.     printf("Enter correct value");
  87.     printf("\n");
  88.     printf("\n");
  89. }
  90.  
  91.  
  92.  
  93. printf("\nIf want candy press 1 for no 0");
  94. printf("\n Please, make your choice: ");
  95. scanf("%f" ,&candy);
  96. if (candy == 1){
  97. printf("\nHow many kilograms do you want:");
  98. printf("\n Please, make your choice: ");
  99. scanf("%f", &candyWeight);
  100. sumForCandy = candyWeight * candyPricePerKilo;
  101. printf("\nThe price for this product is : %.2f BGN ", sumForCandy);
  102. printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy);
  103. printf("\n");
  104. printf("\n");
  105. }
  106. else if (candy == 0){
  107.     printf("Thanks, Your bill for this product is : %.2f BGN", sumForCandy);
  108.     printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy);
  109.     printf("\n");
  110.     printf("\n");
  111. }
  112. else if (candy > 1){
  113.     printf("Enter correct value");
  114.     printf("\n");
  115.     printf("\n");
  116. }
  117.  
  118.  
  119. printf("\nIf want yogurt 1 for no 0");
  120. printf("\n Please, make your choice: ");
  121. scanf("%f", &yogurt);
  122. if (yogurt == 1){
  123. printf("\nHow many pcs do you want:");
  124. printf("\n Please, make your choice: ");
  125. scanf("%d", &yogurtPerPcs);
  126. sumForYogurt =  yogurtPerPcs * yogurtPrice;
  127. printf("\nThe price for this product is : %.2f BGN ", sumForYogurt);
  128. printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt);
  129. printf("\n");
  130. printf("\n");
  131. }
  132. else if (yogurt == 0){
  133.     printf("Thanks, Your bill for this product is : %.2f BGN", sumForYogurt);
  134.     printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt);
  135.     printf("\n");
  136.     printf("\n");
  137. }
  138. else if (yogurt > 1){
  139.     printf("Enter correct value");
  140.     printf("\n");
  141.     printf("\n");
  142. }
  143.  
  144.  
  145.  
  146. printf("\nIf want icecream press 1 for no 0");
  147. printf("\n Please, make your choice: ");
  148. scanf("%f", &iceCream);
  149. if (iceCream == 1){
  150. printf("\nHow many pcs do you want:");
  151. printf("\n Please, make your choice: ");
  152. scanf("%d", &iceCreamPerPcs);
  153. sumForIceCream = iceCreamPerPcs * iceCreamPrice;
  154. printf("\nThe price for this product is : %.2f BGN ", sumForIceCream);
  155. printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt + sumForIceCream);
  156. printf("\n");
  157. printf("\n");
  158. }
  159. else if (iceCream == 0){
  160.     printf("Thanks, Your bill for this product is : %.2f BGN", sumForIceCream);
  161.     printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt + sumForIceCream);
  162.     printf("\n");
  163.     printf("\n");
  164. }
  165. else if (iceCream > 1){
  166.     printf("Enter correct value");
  167.     printf("\n");
  168.     printf("\n");
  169. }
  170.  
  171.  
  172. printf("\nIf want lolipoop press 1 for no 0");
  173. printf("\n Please, make your choice: ");
  174. scanf("%f", &lolipoop);
  175. if (lolipoop == 1){
  176. printf("\nHow many pcs do you want:");
  177. printf("\n Please, make your choice: ");
  178. scanf("%d", &lolipopPerPcs);
  179. sumForLoliPop = lolipoopPrice * lolipopPerPcs;
  180. printf("\nThe price for this product is : %.2f BGN ", sumForLoliPop);
  181. printf("\n");
  182. printf("\n");
  183. }
  184. else if (lolipoop == 0){
  185.     printf("Thanks, Your bill for this product is : %.2f BGN", sumForLoliPop);
  186.     printf("\n");
  187.     printf("\n");
  188. }
  189. else if (lolipoop > 1){
  190.     printf("Enter correct value");
  191.     printf("\n");
  192.     printf("\n");
  193. }
  194.  
  195. totalSumOfAllProductsIs = sumForTomato + sumForFlour + sumForCandy + sumForYogurt + sumForIceCream + sumForLoliPop;
  196. printf("\n");
  197. printf("Your total sum for pay is : %.2f BGN", totalSumOfAllProductsIs);
  198.  
  199. return 0;
  200.  
  201. }
Add Comment
Please, Sign In to add comment