FORTRAN is an general purpose imperative programming language that is especially used for numeric computation and scientific computing originally developed by IBM. This programming language is used in the area of high performance computing and supercomputers. Today I will Show you How to create and run a FORTRAN Program.
How to create and run a FORTRAN Program
STEP 1:- Download Compiler for Fortran Know as silverfrost (FTN95)
STEP 2:- Install the silverfrost software and accepting all the defaults.
STEP 3:- Now Double Click on Plato and Select File >> New
STEP 4:- Now there will be many Format, You Select Free Format Fortran File and Give the name to your Program such as tato.f95
How To Write a Program in FORTRAN
Start Program :- Fortran program Always Start with Keyword “program” with the name of your program Such as
Data Type Used in Fortran :- real, integer and character
As the name suggest real is used when the input is of Floating Point Nunmber such as “0.12”, interger is used when the input is of real number such as “6”, Character data type hold strings of characters such as “satish”.
real :: x,y,z
Keywords :- In Fortran there are more two keywords which are mostly used for Input and Output they are read and print
print *, ‘Enter two numbers’
// This will Displayed on Output screen
read *, x
read *, y
// This will take Input from the Keyword
Operator :- You can use all operator such as + for addition, – for subtraction, = Assigment Operator and So on.
Stop Program :- Now to Stop Program, You have to use end Keyword such as
end program tato
Here is an Example of Fortran Program, Compile and Run it
STEP 1:- Open New File and give the name as tato.f95
STEP 2:- Copy and Paste the below Program
real :: x,y
print *, ‘enter the values x and y’
read *, x,y
print *, ‘the values you typed are for y,x are: ‘,y,x
end program tato
STEP 3:- Now Press Run Button, to run the program.
STEP 4:- Now it will ask you to “enter the values x and y'” Enter any Number and press Enter.
STEP 5:- Now it will give you an Output “the values you typed are for y,x are: (Your given Number or Input Values)”