Answer to Question #48367 in C++ for ankita

Question #48367
in shop rs 30 discount if the purchase amount is more than 200 otherwise give rs10 discount display amount to be paid
Expert's answer
#include <iostream> //for cout

using namespace std; //for using cout instead ofstd::cout

int main () {
//constants
constdouble rs_discount_high = 0.7; //100%-30% = 70%
constdouble rs_discount_low = 0.9; //100%-10%= 90%
constdouble boundary = 200;

doublepurchase_ammount;

cout<< "Input purchase ammount: ";
cin>> purchase_ammount;

//coutwith if (trenary operation ?)
cout<< "Ammount to be paid: " <<
purchase_ammount*
(purchase_ammount> boundary ? rs_discount_high : rs_discount_low)
<<endl;

return0;
}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal