daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var a,b : real;
  2. var c : string;
  3.  
  4. begin
  5.  
  6. write('insira um valor para A: ');
  7. readln(a);
  8. write('insira um valor para B: ');
  9. readln(b);
  10.  
  11. write('insira o operador aritimetico: ');
  12. readln(c);
  13.  
  14. while ( (c<>'+') or (c<>'-') or (c<>'*') or (c<>'/') ) do
  15. begin
  16. writeln('Operacao invalida');
  17. writeln('Insira um operador aritimetico valido: ');
  18. readln(c);
  19. end;
  20.  
  21. Case c of
  22.  
  23. '+':
  24. begin
  25. writeln(A:0:2,C,B:0:2,' = A + B = ',(A+B):0:2);
  26. end;
  27.  
  28. '-':
  29. begin
  30. writeln(A:0:2,C,B:0:2,' = A - B = ',(A-B):0:2);
  31. end;
  32.  
  33. '*':
  34. begin
  35. writeln(A:0:2,C,B:0:2,' = A * B = ',(A*B):0:2);
  36. end;
  37.  
  38. '/':
  39. begin
  40. If (b=0) then
  41. begin
  42. writeln(A,C,B,' = A / B = ');
  43. writeln('Expressao invalida: divisao por zero.');
  44. end;
  45.  
  46. writeln(A:0:2,C,B:0:2,' = A + B = ',(A/B):0:2);
  47. end;
  48. end;
  49.  
  50.  
  51.  
  52.  readln();
  53.  
  54. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top