Skip to content
Snippets Groups Projects
Commit 1e70603e authored by dali662d's avatar dali662d
Browse files

Upload New File

parent 86298cb9
No related branches found
No related tags found
No related merge requests found
program taschenrechner
implicit none
INTEGER :: a, b ! Variablen
CHARACTER :: op ! Operator
INTEGER :: res ! Result
WRITE(*,*) "Gebe zwei Zahlen ein!"
READ(*,*) a, b
WRITE(*,*) "Gebe einen Rechenoperator (+,-,*,/) ein!"
READ(*,*) op
IF (op == "+") THEN
res = a + b
WRITE(*,*) "Das Ergebnis ist ", res
ELSEIF (op == "-") THEN
res = a - b
WRITE(*,*) "Das Ergebnis ist ", res
ELSEIF (op == "*") THEN
res = a * b
WRITE(*,*) "Das Ergebnis ist ", res
ELSEIF (op == "/") THEN
IF (b == 0) THEN
WRITE(*,*) "Division durch 0 ist veboten!"
ELSE
res = a / b
WRITE(*,*) "Das Ergebnis ist ", res
END IF
ELSE
WRITE(*,*) "Der Eingegebene Operator ist ungueltig."
END IF
end program taschenrechner
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment