Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main (void){
- int eggType, eggOrders, amount;
- float typ1 = 15.00, typ2 = 22.50, typ3 = 13.00;
- float typ, change = 0, discount = 0, discprice = 0;
- printf("Itlog ni Noy AKIL!");
- printf("\n[1] #16 @ Php 15.00");
- printf("\n[2] #18 @ Php 22.50");
- printf("\n[3] penoy @ Php 13.00\n");
- do{
- printf("Enter your egg type: ");
- scanf("%d", &eggType);
- }
- while (eggType < 1 || eggType > 3);
- printf("Enter total egg orders: ");
- scanf("%d", &eggOrders);
- printf("Enter amount: ");
- scanf("%d", &amount);
- if (eggType == 1){
- typ = typ1 * eggOrders;
- }
- else if (eggType == 2){
- typ = typ2 * eggOrders;
- }
- else if (eggType == 3){
- typ = typ3 * eggOrders;
- }
- if (eggOrders >= 300){
- discount = typ * 0.1;
- }
- else if (eggOrders >= 150){
- discount = typ * 0.05;
- }
- printf("\nSUMMARY\n");
- printf("Total Cost: Php %.2f", typ);
- printf("\nDiscount: Php %.2f", discount);
- change = amount - typ;
- if (discount > 0){
- discprice = typ - discount;
- printf("\nDiscounted Price: Php %.2f", discprice);
- change = amount - discprice;
- }
- if (change > 0){
- printf("\nChange: Php %.2f\n", change);
- } else {
- change *= -1;
- printf("\nChange: (Php %.2f)\n", change);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement