Friday, May 13, 2022

How To install GFortran ( Fortran Programming Language ) & Write a Hello World Program On Ubuntu 20.04

 ________________________________________________________________________________________
How To install GFortran ( Fortran Programming Language ) & Write a Hello World Program On Ubuntu 20.04
________________________________________________________________________________________

FORTRAN is a powerful programming language that is often over-shadowed by the more popular mainstream programming languages.

apt update ; apt-get install gfortran -y
gfortran --version
whereis gfortran ; which gfortran

Fortran Hello World Example: How To Write and Execute Fortran Program on Linux OS
nano helloworld.f
program hello
print *,"Hello World!"
end program hello


shorter Version  -
nano helloworld.f
PRINT *,"Hello World!"
END

Compile the Fortran program - gfortran -ffree-form helloworld.f
Execute the Fortran program (a.out) - ./a.out
mv a.out helloworld
./helloworld
_______________________________________________________________________________________

No comments:

Post a Comment