Filter löschen
Filter löschen

create a calculator using arithmetic operators

3 Ansichten (letzte 30 Tage)
abdul rehman
abdul rehman am 28 Apr. 2020
Kommentiert: abdul rehman am 28 Apr. 2020
a=input(prompt,'s');
c=2;
d=3;
h=6;
if a=='+'
e=c+d;
e
else
e=c-d;
e
end
what is wrong with this addition code?

Akzeptierte Antwort

KSSV
KSSV am 28 Apr. 2020
prompt = 'Enter sign:' ;
a=input(prompt,'s');
c=2;
d=3;
h=6;
if strcmp(a,'+')
e=c+d;
e
else
e=c-d;
e
end

Weitere Antworten (0)

Kategorien

Mehr zu Search Path finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by