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.
#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;
}
Comments
Leave a comment