create a calculator using arithmetic operators

8 vues (au cours des 30 derniers jours)
abdul rehman
abdul rehman le 28 Avr 2020
Commenté : abdul rehman le 28 Avr 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?

Réponse acceptée

KSSV
KSSV le 28 Avr 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

Plus de réponses (0)

Catégories

En savoir plus sur Search Path dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by