New course! Every coder should learn Generative AI!
Try a free lesson0
Please help me with this
A shop will give discount of 10% if the cost of purchase quantity is more than 1000. Ask user for quantity Suppose, one unit will cost 100. Judge and print cost for user
5 Answers
+ 1
Hi! Please, show us your attempt!
+ 1
If it is a sololearn task, please mention task number.
Read the lesson again, try to write thw code, them show us the code so we can check on it!
+ 1
kwesi HotTea
totalAmount = totalAmount - discount;
0
Okay cool
0
Using namespace std;
int main () {
float discount, totalAmount, totalQuantity;
int unit = 100;
cout <<“enter your quantity=“;
cin >> totalQuantity;
totalAmount=totalQuantity * unit;
if(totalQuantity > 1000){
discount = totalAmount * 10/100;
cout << “your discount is : “<< discount << endl;
totalAmount = totalQuantity _discount;
cout <<“your total cost :”<< totalAmount <<endl;
} else{
cout <<“there’s no discount”;
}
return 0;
}