input price & quantity.if net price is greater than 10000 the discount is 10%.if we enter -1 as the price then the code must stop and calculate the net price
#include <iostream>
using namespace std;
int main(){
float price = 0, net_price, p;
int quantity = 1;
do{
cout<<"Input price: \n";
cin>>p;
if(p != -1) price = p;
else break;
if(price > 10000) price *= 0.9;
cout<<"Input quantity: \n";
cin>>quantity;
net_price = price / quantity;
}while(p != -1);
cout<<"Net price = "<<net_price<<endl;
return 0;
}
Comments
Leave a comment