Main Menu

friends

Banner

Latest articles

very simple mysql connection from php
01/01/2010 | mad mad mod

This article describes how to connect to a mysql database from a php script. It is realy the most simple way of using mysql databases in php, no fancy wrapper classes, no functions and NO security! W [ ... ]


hello world in tcl - radically simple
07/01/2010 | mad mad mod

This article describes how to write and execute a "Hello World" tclsh script on Linux (Fedora).  1. the prerequisitesa text editor of your choice (e.g. vi)tclsh - Simple shell containing Tcl inte [ ... ]


Other Articles

Designed by:
SiteGround web hosting Joomla Templates
Hello World in Fortran E-mail
programming

This article describes how to write, compile and execute a "Hello World" program in Fortran on Linux (RedHat / Centos / Fedora).

 

1. the prerequisites

  • a text editor of your choice (e.g. vi)
  • a Fortran compiler (e.g. gfortran - the GNU Fortran 95 compiler)


make sure you have installed the GNU Fortran 95 compiler rpm:

# rpm -qa  gcc-gfortran
gcc-gfortran-4.1.2-46.el5_4.1

 

If it is not installed yet, you can install it with yum (you need to be root to do that):

# yum install gcc-fortran

 

 

 

2. write the code


open an empty file with a text editor (e.g. vi):


# vi helloworld.f



now write the following code into the sourcefile:


      program helloworld
         print *,"Hello World!"
      end program helloworld

Please note: there are 6 spaces at the beginning of each line!


save the file and exit vi with ":wq + enter"

explanation


program helloworld

The name of our program is "helloworld". This is not required, but is recommended.

 


print *,"Hello World!"

The command "print *" prints items to the screen.

 


      end program helloworld

marks the end of the program "helloworld".

 

 

3. compile the code



# gfortran helloworld.f -o helloworld




This produces an executable called "helloworld".



4. run the program


you can now execute the binary program with:


# ./helloworld
Hello World!

 

 

 

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

 
mad mad mod, Powered by Joomla! and designed by SiteGround web hosting