PROGRAM Calculator (Input,Output);

VAR
   Operand1, Operand2 : Real;
   Result : Real;
   Operator : Char;

BEGIN
   Writeln('Enter a binary arithmetic expression in postfix notation.');
   Writeln('Use + - * / as operator');
   Readln(Operator,Operand1,Operand2);

   IF (Operator <> '+') AND
      (Operator <> '-') AND
      (Operator <> '*') AND
      (Operator <> '/') THEN
         Writeln('Invalid operator.  Must be + - * / only.')
   ELSE
     BEGIN
       IF Operator = '+' THEN
          Result := Operand1 + Operand2
       ELSE IF Operator = '-' THEN
          Result := Operand1 - Operand2
       ELSE IF Operator = '*' THEN
          Result := Operand1 * Operand2
       ELSE IF Operator = '/' THEN
          IF Operand2 <> 0 THEN
             Result := Operand1 / Operand2
          ELSE
             Writeln('No division by zero');
       Writeln('= ',Result:1:1);
     END;
END.
