Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

progx

Posted on 1997-03-11
1
Medium Priority
?
202 Views
Last Modified: 2010-04-16
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.      
0
Comment
Question by:hmalkuz1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
chump earned 60 total points
ID: 1215240
program Calc;

var real1, real2 : real;
    choice       : string;

begin

  write("Number 1: ");
  readln(real1);
  write("Number 2: ");
  readln(real2);

  write("Choice: ");
  readln(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.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With the evolution of technology, we have finally reached a point where it is possible to have home automation features like having your thermostat turn up and door lock itself when you leave, as well as a complete home security system. This is a st…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question