miércoles, 10 de marzo de 2010

SENTENCIA CASE



EN ESTE PROGRAMA SE PUEDEN HACER SUMAS, RESTAS, DIVISIONES Y MULTIPLICACIONES
program calculadora;
uses
crt;
var
operador:char;
a:integer;
b:integer;
begin
clrscr;
writeln('Introduce el primer numero');
readln(a);
writeln('Introduce el operador');
readln(operador);
writeln('Introduce el segundo numero');
readln(b);
case operador of
'+':writeln('Suma', a+b);
'-':writeln('Resta', a-b);
'/':writeln('Division', a/b);
'*':writeln('Multiplicacion');
else
writeln('Esa opcion no existe');
end;
readln;
end.

No hay comentarios:

Publicar un comentario