16 May 2013

HOW TO WRITE FORTRAN PROGRAM THAT WILL COMPUTE THREE (3) TIMES TABLE FROM ONE(1) TO HUNDRED

In order to make learning more easy and enjoyable, we have come up with this site to teach you the basics of every information and field you need to achieve your dream goal

          Here I will be giving you the simple code(program) that will compute three times table using a fortran 90/95 compiler
Before I proceed forward I will like to say don’t be afraid if you are actually looking for fortran 75 code this is because in this tutorial I will show you how to manipulate this codes to your desired
          In writing program for a particular problem, all you have to do is to think of the possible means of solving the problem given to you but before doing that you have to first of all define the problem


What do I mean by defining problem?

          In life is it said that ‘purpose if not know abuse is inevitable’ this applies to programming, therefore in order to write a program for a given problem you have to think of what the problem wants to achieve, the steps it will follow, the tools or logic that will be applied and finally how to implement it (environment)
After defining the problem set out think of possible ways to solve the defined problem, then implement the ways thought out

Program
Compute three time table from one to hundred
In this program I made use of do construct, here the do construct starts from one, steps by one and terminates at hundred
The program is as written below

                                 !------------------------------------------
                 !this program produce three times table
                        !------------------------------------------
                                      program     TTTable
                                      implicit       none
                                       integer :: i
                                              do i=1,100,1
                                              print *, 3*i
                                              end do
                                              end program Table

will in the case of fortran 75 replace in the program above (print*,3*i) with (write (**), 3*i
 hope the program helped you do come back for more and also leave your comments

No comments :

Post a Comment