Computer Science, asked by mriyanjk200417, 5 months ago

A supermarket is giving discount on a specific product having rate as rs100/-.

Discount is based on quantity as follows:

Quantity

>50

>30
otherwise
discount(%)
10
5
nil

otherwise nil

Write a program to input quantity and calculate discount and bill amount after

discount.​

Answers

Answered by dreamrob
0

Program in C++

#include<iostream>

using namespace std;

int main()

{

int q;

cout<<"Enter Quantity : ";

cin>>q;

int total = q * 100;

int discount;

if(q >= 50)

{

 discount = (total * 10) / 100;

}

else if(q >= 30)

{

 discount = (total * 5) / 100;

}

else

{

 discount = 0;

}

int net = total - discount;

cout<<"Quantity = "<<q<<endl;

cout<<"Total price = "<<total<<endl;

cout<<"Discount = "<<discount<<endl;

cout<<"Price after discount = "<<net;

return 0;

}

Output 1:

Enter Quantity : 60

Quantity = 60

Total price = 6000

Discount = 600

Price after discount = 5400

Output 2:

Enter Quantity : 40

Quantity = 40

Total price = 4000

Discount = 200

Price after discount = 3800

Output 3:

Enter Quantity : 20

Quantity = 20

Total price = 2000

Discount = 0

Price after discount = 2000

Similar questions