Write function for car sales

2 Ansichten (letzte 30 Tage)
SuzieChan
SuzieChan am 22 Okt. 2019
Bearbeitet: KALYAN ACHARJYA am 22 Okt. 2019
Hello,
Can you help me werite a function called car_sale_profit.m
'Profit' if car sales ⩾ 1000 and ≤ 2000
'Loss' if car sales ⩾ 0 and < 1000
The function should use one scalar input (car sales profit).
It should display text to screen for the clients.
Thank you.

Antworten (1)

KALYAN ACHARJYA
KALYAN ACHARJYA am 22 Okt. 2019
Bearbeitet: KALYAN ACHARJYA am 22 Okt. 2019
Requested you to read here about function call and here for if else , Without understanding, do not just copy paste the program, any query let me know?
function sales_fun(car_num)
if car_num>=1000 && car_num<=2000
disp('Profit');
else
disp('Loss');
end
  2 Kommentare
SuzieChan
SuzieChan am 22 Okt. 2019
thanks dear.
how i test this function in the command window?
KALYAN ACHARJYA
KALYAN ACHARJYA am 22 Okt. 2019
Bearbeitet: KALYAN ACHARJYA am 22 Okt. 2019
Just call it from command window or from any other Matlab script
Command Window:
sales_fun(enter_any sales_number_here);
%...............^^^^

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Install Products finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by