Computer Science, asked by kishoreji6907, 11 months ago

A shop will give discount of 10% if the cost of purchased is more than 1000. ask user for quantity suppose one unit will cot 100.judgee and print total cost for user

Answers

Answered by ridhimakh1219
1

A shop will give discount of 10% if the cost of purchased is more than 1000. ask user for quantity suppose one unit will cot 100.judgee and print total cost for user

Explanation:

C++ program  to calculate and print the total expenses made by user

#include<iostream>

using namespace std;

int main()

{

int totalexp, qty, price, discount;

cout<<"Enter quantity:";  //input value of quantity

cin>>qty;

cout<<"Enter price:";   // input price

cin>>price;

totalexp=qty*price;  // calculate total expenses

if(totalexp>1000) //condition to check total expenses is more than 1000

{

 discount=(totalexp*0.1); // 10% discount is applicable

 totalexp=totalexp-discount;

}

cout<<"Total Expense is Rs. "<<totalexp;

return 0;

}

Output

Enter quantity:50                        

Enter price:500                                           

Total Expense is Rs. 22500  

Answered by edwinlee6368
0

Answer:

unit_price = 100

discount_threshold = 1000

quantity = int(input("Quantity -> "))

total = quantity * unit_price

if total > discount_threshold:

   total = (quantity * unit_price) - (100 * 10/100)

print("Your total is {}".format(total))

Explanation:

Similar questions