Finding a way to run Fortran programs in android with the help of Termux? In this article, I’ll show you how you can easily install Fortran in termux to compile and run Fortran programs in termux.
What is Fortran?
Fortran, i.e., formula translator, is a programming language designed in the 1950s by IBM for scientists and engineers, and even today, it is used for scientific computing.
Install Fortran In Termux
Installing Fortran in Termux is so easy. Open your termux application and follow these simple commands below, and you’ll have Fortran in your Termux in no time.
Note: Make sure you have installed Termux from F-droid.
- Update the list of packages in termux.
- Upgrade all the upgradable packages in termux.
- Install lfortran package using the apt package manager in your termux application.
apt install lfortran
That’s it; you’ve successfully installed Fortran in your termux application and with the help of lfortran package, you can compile and run your Fortran programs.
Compile and run Fortran programs in Termux
Now to compile a Fortran program, simply type
lfortan filename -o output_file_name for example, if your file is hello.f90, so you need to type
lfortran hello.f90 -o hello
compile : lfortan filename -o output_file_name example : lfortran hello.f90 -o hello
After your file is compiled simply type
./compile_filename to run it.
run: ./compiled_filename example: ./hello
So this is how you can install and run Fortran programs with the help of lfortran package in termux. Watch the video below if you’ve encountered errors while installing Fortran.
Read More In Termux: