Main Menu

friends

Banner

Latest articles

Hello World in perl
18/11/2009 | mad mad mod

This article describes how to write and execute a "Hello World" perl script on Linux (Fedora).  1. the prerequisitesa text editor of your choice (e.g. vi)the perl interpreter
make sure you have in [ ... ]


NASA: 2012: Beginning of the End or Why the World Won't End?
18/11/2009 | mad mad mod

  NASA F.A.Q. about 2012: http://www.nasa.gov/topics/earth/features/2012.html     


Other Articles
Facebook MySpace Twitter Digg Delicious Stumbleupon Google Bookmarks 

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