fork download
  1. PROGRAM einfacher_Taschenrechner;
  2.  
  3. Var int1,int2,result :single;
  4. op,choice :char;
  5.  
  6. BEGIN
  7. REPEAT
  8. write('Erste Zahl:');
  9. readln(int1);
  10. write('Zweite Zahl:');
  11. readln(int2);
  12. write ('Rechenmethode(+,-,*,/):');
  13. readln(op);
  14. IF op='+' THEN
  15. BEGIN
  16. result:=int1+int2
  17. END
  18. ELSE IF op='-' THEN
  19. BEGIN
  20. result:=int1-int2
  21. END
  22. ELSE IF op='*' THEN
  23. BEGIN
  24. result:=int1*int2
  25. END
  26. ELSE IF op='/' THEN
  27. BEGIN
  28. result:=int1/int2;
  29. END;
  30. write('Das Ergebnis lautet: ' ,result:10:6);
  31. write('Eine weitere Berechnung?(J/N)');
  32. readln(choice);
  33. UNTIL (choice='N') OR (choice='n');
  34. END.
Success #stdin #stdout 0.01s 5288KB
stdin
2
2
*
n
stdout
Erste Zahl:Zweite Zahl:Rechenmethode(+,-,*,/):Das Ergebnis lautet:   4.000000Eine weitere Berechnung?(J/N)