Friday, 5 July 2013

Write a program to accept the book name and selling price and find out the discount on selling price. If selling price is above 1000 discount is of 20% and if selling price is between 800-1000 discount is 15% and if selling price is less than 500 no discount is given.

#include<iostream>
using namespace std;
int main()
{
char name[25];
cout<<"Enter the name of the book- ";
cin>>name;
float price;
cout<<"Enter the price of the book- ";
cin>>price;
if(price>=1000)
{
cout<<"The discount on the book "<<name<<"is 20%";
}
if(price<1000 && price>=800)
{
cout<<"The discount on the book "<<name<<"is 15%";
}
if(price<800 && price>=500)
{
cout<<"Our sir did not mention how much discount has to be given on the book "<<name<<"!!!!";
}
if(price<500)
{
cout<<"No discount is given on the book "<<name;
}

}

No comments:

Post a Comment