Answer to Question #313935 in C for Laurente

Question #313935

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, create a program on it


1
Expert's answer
2022-03-18T12:13:37-0400
#include <stdio.h>

int main()
{
    float quant, prc, total, discount;
    total = 0;
    discount = 0;
    printf("Enter quantity: ");
    scanf("%f", &quant);
    printf("Enter price per item: ");
    scanf("%f", &prc);
    if (quant > 1000)
    {
        discount = (quant * prc) * 0.1;
        total = (quant * prc) - discount;
        printf("\n\nTotal: %.2f\n", (quant * prc));
        printf("Discount: %.2f\n", discount);
        printf("\nTotal with discount: %.2f\n", total);
    }
    else
    {
        total = quant * prc;
        printf("\nTotal: %.2f\n", total);
    }
    getchar();
}   

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