Tuesday, 20 December 2011

Calculate bill with discount in C++


/*Enter Quantity and cost, Calculate total Bill According to the Following Condition:
if bill is greater than 200 then 2% discount
otherwise give 3% discount */

#include <iostream.h>
#include <conio.h>
void main ()
{
int bill, disc, total, qty, cost;
cout <<" Enter Quantity: ";
cin >>qty;
cout <<" Enter Cost: ";
cin >>cost;
bill=qty*cost;
if (bill>200)
{
disc=bill*2/100;
}
else
{
disc=bill*3/100;
}
total=bill-disc;
cout <<"Total Bill After Discount: "<<total;
getch ();
}

No comments:

Post a Comment