Skip to content
Snippets Groups Projects
Commit 15b23e93 authored by dali662d's avatar dali662d
Browse files

Upload New File

parent 90a01744
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
LOGICAL :: calc = .true.
WRITE(*,*) "Gebe zwei Zahlen ein!"
READ(*,*) a, b
WRITE(*,*) "Gebe einen Rechenoperator (+,-,*,/) ein!"
READ(*,*) op
SELECT CASE (op)
CASE("+")
res = a + b
CASE("-")
res = a - b
CASE("*")
res = a * b
CASE("/")
IF (b == 0) THEN
WRITE(*,*) "Division durch 0 ist veboten!"
calc = .false.
ELSE
res = a / b
END IF
CASE DEFAULT
WRITE(*,*) "Der Eingegebene Operator ist ungueltig."
calc = .false.
END SELECT
IF (calc) WRITE(*,*) "Das Ergebnis ist ", res
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