Question #29592

develop a menu driven program in psuedocode that inputs two numbers and at the users option finds their sum difference product or quotient

Expert's answer

program calculator;

uses crt;

var a,b,c:real;

x:integer;

Begin

Writeln('Enter two numbers');

Readln(a,b);

Writeln(' Select action');

Writeln('1-"+" 2-"-" 3-"*"4-"/"');

Readln(x);

case x of

1: beginc:=a+b; Writeln(c:2:2); end;

2: beginc:=a-b; Writeln(c:2:2); end;

3: begin c:=a*b; Writeln(c:2:2); end;

4: if b=0 thenWriteln(' It is impossible to divide into zero')

elsebegin c:=a/b; Writeln(c:2:2); end;

end;

Readln;

end.

uses crt;

var a,b,c:real;

x:integer;

Begin

Writeln('Enter two numbers');

Readln(a,b);

Writeln(' Select action');

Writeln('1-"+" 2-"-" 3-"*"4-"/"');

Readln(x);

case x of

1: beginc:=a+b; Writeln(c:2:2); end;

2: beginc:=a-b; Writeln(c:2:2); end;

3: begin c:=a*b; Writeln(c:2:2); end;

4: if b=0 thenWriteln(' It is impossible to divide into zero')

elsebegin c:=a/b; Writeln(c:2:2); end;

end;

Readln;

end.

## Comments

## Leave a comment