Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- float tomato = 0;
- float flour = 0;
- float candy = 0;
- const float tomatoPricePerKilo = 4.50;
- const float flourPricePerKilo = 1.80;
- const float candyPricePerKilo = 1.50;
- float tomatoWeigth = 0;
- float flourWeight = 0;
- float candyWeight = 0;
- float yogurt = 0;
- float iceCream = 0;
- float lolipoop = 0;
- const float yogurtPrice = 0.50;
- const float iceCreamPrice = 0.60;
- const float lolipoopPrice = 0.15;
- int yogurtPerPcs = 0;
- int iceCreamPerPcs = 0;
- int lolipopPerPcs = 0;
- float sumForTomato = 0;
- float sumForFlour = 0;
- float sumForCandy = 0;
- float sumForYogurt = 0;
- float sumForIceCream = 0;
- float sumForLoliPop = 0;
- float totalSumOfAllProductsIs = 0;
- printf("\nIf want tomato press 1 for no 0");
- printf("\n Please, make your choice: ");
- scanf("%f", &tomato);
- if (tomato == 1){
- printf("\nHow many kilograms do you want:");
- printf("\n Please, make your choice: ");
- scanf("%f", &tomatoWeigth);
- sumForTomato = tomatoWeigth * tomatoPricePerKilo;
- printf("\nThe price for this product is : %.2f BGN ", sumForTomato);
- printf("\n");
- printf("\n");
- }
- else if (tomato == 0){
- printf("Thanks, Your bill for this product is : %.2f BGN", sumForTomato);
- printf("\n");
- printf("\n");
- }
- else if (tomato > 1){
- printf("Enter correct value");
- printf("\n");
- printf("\n");
- }
- printf("\nIf want flour press 1 for no 0");
- printf("\n Please, make your choice: ");
- scanf("%f", &flour);
- if (flour == 1){
- printf("\nHow many kilograms do you want:");
- printf("\n Please, make your choice: ");
- scanf("%f", &flourWeight);
- sumForFlour = flourPricePerKilo * flourWeight;
- printf("\nThe price for this product is : %.2f BGN ", sumForFlour);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour);
- printf("\n");
- printf("\n");
- }
- else if (flour == 0){
- printf("Thanks, Your bill for this product is : %.2f BGN", sumForFlour);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour);
- printf("\n");
- printf("\n");
- }
- else if (flour > 1){
- printf("Enter correct value");
- printf("\n");
- printf("\n");
- }
- printf("\nIf want candy press 1 for no 0");
- printf("\n Please, make your choice: ");
- scanf("%f" ,&candy);
- if (candy == 1){
- printf("\nHow many kilograms do you want:");
- printf("\n Please, make your choice: ");
- scanf("%f", &candyWeight);
- sumForCandy = candyWeight * candyPricePerKilo;
- printf("\nThe price for this product is : %.2f BGN ", sumForCandy);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy);
- printf("\n");
- printf("\n");
- }
- else if (candy == 0){
- printf("Thanks, Your bill for this product is : %.2f BGN", sumForCandy);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy);
- printf("\n");
- printf("\n");
- }
- else if (candy > 1){
- printf("Enter correct value");
- printf("\n");
- printf("\n");
- }
- printf("\nIf want yogurt 1 for no 0");
- printf("\n Please, make your choice: ");
- scanf("%f", &yogurt);
- if (yogurt == 1){
- printf("\nHow many pcs do you want:");
- printf("\n Please, make your choice: ");
- scanf("%d", &yogurtPerPcs);
- sumForYogurt = yogurtPerPcs * yogurtPrice;
- printf("\nThe price for this product is : %.2f BGN ", sumForYogurt);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt);
- printf("\n");
- printf("\n");
- }
- else if (yogurt == 0){
- printf("Thanks, Your bill for this product is : %.2f BGN", sumForYogurt);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt);
- printf("\n");
- printf("\n");
- }
- else if (yogurt > 1){
- printf("Enter correct value");
- printf("\n");
- printf("\n");
- }
- printf("\nIf want icecream press 1 for no 0");
- printf("\n Please, make your choice: ");
- scanf("%f", &iceCream);
- if (iceCream == 1){
- printf("\nHow many pcs do you want:");
- printf("\n Please, make your choice: ");
- scanf("%d", &iceCreamPerPcs);
- sumForIceCream = iceCreamPerPcs * iceCreamPrice;
- printf("\nThe price for this product is : %.2f BGN ", sumForIceCream);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt + sumForIceCream);
- printf("\n");
- printf("\n");
- }
- else if (iceCream == 0){
- printf("Thanks, Your bill for this product is : %.2f BGN", sumForIceCream);
- printf("\nYour current bill is: %.2f BGN", sumForTomato + sumForFlour + sumForCandy + sumForYogurt + sumForIceCream);
- printf("\n");
- printf("\n");
- }
- else if (iceCream > 1){
- printf("Enter correct value");
- printf("\n");
- printf("\n");
- }
- printf("\nIf want lolipoop press 1 for no 0");
- printf("\n Please, make your choice: ");
- scanf("%f", &lolipoop);
- if (lolipoop == 1){
- printf("\nHow many pcs do you want:");
- printf("\n Please, make your choice: ");
- scanf("%d", &lolipopPerPcs);
- sumForLoliPop = lolipoopPrice * lolipopPerPcs;
- printf("\nThe price for this product is : %.2f BGN ", sumForLoliPop);
- printf("\n");
- printf("\n");
- }
- else if (lolipoop == 0){
- printf("Thanks, Your bill for this product is : %.2f BGN", sumForLoliPop);
- printf("\n");
- printf("\n");
- }
- else if (lolipoop > 1){
- printf("Enter correct value");
- printf("\n");
- printf("\n");
- }
- totalSumOfAllProductsIs = sumForTomato + sumForFlour + sumForCandy + sumForYogurt + sumForIceCream + sumForLoliPop;
- printf("\n");
- printf("Your total sum for pay is : %.2f BGN", totalSumOfAllProductsIs);
- return 0;
- }
Add Comment
Please, Sign In to add comment