Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ program to calculate discount

/*no:Departmental store offers 2.5% discount on shopping of 20,000
and more Rs. 1.5% discount on shopping of 5000 Rs and more.
and no discount on shopping of less than 5000Rs to those customer who have
membership cards. Design a program that accepts total bill
of buyer and membership card(Y/N) as input and calculates amount to be paid after
applying discount?*/

#include<iostream>
using namespace std;
int main()
{
	float a;
	char b;
	cout<<"Enter a Total bill=";
	cin>>a;
	cout<<"Do you a Membership card=";
	cin>>b;
	if(a>=2000&&b=='y')
	{
		cout<<a-(a*2.5/100);
	}
	else if(a>=5000&&b=='y')
		{
			cout<<a-(a*1.5/100);
		}
	else
	cout<<a;
}
 
PREVIOUS NEXT
Tagged: #program #calculate #discount
ADD COMMENT
Topic
Name
9+4 =