Write a C++ code that will calculate the amount that a customer need to pay after the discount. The customer just need to key in the total amount and the program will calculate the discounted amount accordingly. For total amount more than RM500.00 the discount value is 10%. For total amount less than RM500.00 the discount value is 8%.
#include <iostream>
int main()
{
double amount = 0, discount = 8;
std::cout<<"Enter the total amount: ";
std::cin>>amount;
if(amount >= 50000)
{
discount = 10;
}
std::cout<<"Amount - discount is: "<<amount - amount * discount / 100<<std::endl;
return 0;
}
Comments
Leave a comment