(1) Write a program that will ask for a price.
(2) If the price is greater than 1000, compute a 10% discount from the original price. Display the computed discount.
(3) If not, just display the original price.
#include <iostream>
using namespace std;
int main() {
float price;
cout << "Please enter price: ";
cin >> price;
cout << "###################################\n";
if (price > 1000){
cout << "The computed discount:\t" << price * 0.1 << endl;
cout << "Your price:\t\t" << price - price * 0.1 << endl;
}
else
cout << "Your price: " << price;
return 0;
}
Comments
Leave a comment