create a calculator using arithmetic operators

8 visualizaciones (últimos 30 días)
abdul rehman
abdul rehman el 28 de Abr. de 2020
Comentada: abdul rehman el 28 de Abr. de 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?

Respuesta aceptada

KSSV
KSSV el 28 de Abr. de 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

Más respuestas (0)

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by