Created
March 18, 2016 02:13
-
-
Save joaolucasl/f3e5f109e71a1f7dbb70 to your computer and use it in GitHub Desktop.
Fortran 95 Calculator YOLO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROGRAM calculator | |
! YOLO Doing Fortran in 2016 | |
! | |
! Hibb is Illuminatti /<o>\ | |
REAL :: num1 ! The target number 1 | |
REAL :: num2 ! The target number 2 | |
REAL :: res ! The result | |
CHARACTER(1) :: op ! The operation | |
! Reads the numbers | |
PRINT *, "Enter the 1st number" | |
READ *, num1 | |
PRINT *, "Enter the 2nd number" | |
READ *, num2 | |
! Reads the operation | |
PRINT *, "Enter the operation (+,-,*,/)" | |
READ *, op | |
! Selecting the right evaluation for the operation | |
SELECT CASE (op) | |
CASE ("+") | |
res = num1 + num2 | |
CASE ("-") | |
res = num1 - num2 | |
CASE ("*") | |
res = num1 * num2 | |
CASE ("/") | |
res = num1 / num2 | |
END SELECT | |
! Then we print the result | |
PRINT *, num1, OP, num2," = ", res | |
END PROGRAM calculator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment