We help IT Professionals succeed at work.

# progx

on
Medium Priority
224 Views
Hello,
please, asap, provide me with any possible ideas, hints or ,in detail,solutions to the following program:-

* Write a pascal program to input two real numbers and give the user the choice to adding, subtracting, multiplying or dividing these numbers. Perform the appropriate calculation and display the result. Your program should trap any attempt to divide by zero.

We have covered the For,repeat,While,and case statements, and arrays.
Comment
Watch Question

## View Solution Only

Commented:
program Calc;

var real1, real2 : real;
choice       : string;

begin

write("Number 1: ");
write("Number 2: ");

write("Choice: ");

write("Result : ");

case choice[1] of
'+' : write(real1 + real2);
'-' : write(real1 - real2);
'*' : write(real1 * real2);
'/' : if real2 = 0 then write("<divide by zero>")
else write(real1 / real2);
end;

writeln;

end.

Not the solution you were looking for? Getting a personalized solution is easy.

##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile