用matlab解一个数学模型
发布网友
发布时间:2022-05-07 08:08
我来回答
共2个回答
热心网友
时间:2023-07-31 03:34
代码:
clear
clc
price = input('输入价格(元): \n \n');
if price < 200
discount = 0;
elseif price < 500
discount = price * 0.03;
elseif price < 1000
discount = price * 0.05;
elseif price < 2500
discount = price * 0.08;
elseif price < 5000
discount = price * 0.1;
elseif price >= 5000
discount = price * 0.14;
else
'Wrong!'
end
price_new = price - discount
热心网友
时间:2023-07-31 03:35
price=input ('请输入商品价格:')
if price<200
zhekou=0;
elseif price>=200&price<500
zhekou=0.03
elseif price>=500&price<1000
zhekou=0.05
elseif price>=1000&price<2500
zhekou=0.08
elseif price>=2500&price<5000
zhekou=0.10
elseif price>=5000
zhekou=0.14
end
price=price*(1-zhekou)