Azzera filtri
Azzera filtri

create a calculator using arithmetic operators

3 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

KSSV
KSSV il 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

Più risposte (0)

Categorie

Scopri di più su Search Path in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by