Answer to Question #309207 in C for Nobody

Question #309207

While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000. If quantity and price per item are input through the keyboard, write a program and a flowchart to calculate the total expenses.


1
Expert's answer
2022-03-10T18:07:36-0500
#include <stdio.h>


int main() {
    int quantity;
    double price;
    double expenses;


    printf("Enter the quantity: ");
    scanf("%d", &quantity);
    printf("Enter a price: ");
    scanf("%lf", &price);


    expenses = quantity * price;
    if (quantity > 1000) {
        expenses *= 0.9;
    }


    printf("The total expenses are %.2lf", expenses);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS