Posts

Showing posts from November, 2017

FACTORIAL IN FORTRAN

1.                  FACTORIAL This program will run factorial numbers from 1 to 10 program factorial !To solve factorial     integer :: a   print *, 'It will solve for factorial' !for 1 a= 1 * 1 print *, 'For 1 = ', a !for 2 a= 2*1 print *, 'For 2 = ', a !for 3 a= 3*2* 1 print *, 'For 3 = ', a !for 4 a= 4*3*2* 1 print *, 'For 4 = ', a !for 5 a= 5*4*3*2* 1 print *, 'For 5 = ', a ! for 6 a= 6*5*4*3*2* 1 print *, 'For 6 = ', a !for 7 a= 7*6*5*4*3*2* 1 print *,'For 7 = ', a !for 8 a= 8*7*6*5*4*3*2* 1 print *, 'For 8 = ', a !for 9 a= 9*8*7*6*5*4*3*2* 1 print *, 'For 9 = ', a !for 10 a= 10*9*8*7*6*5*4*3*2* 1 print *,'For 10 = ', a end program factorial

ROOT IN FORTRAN

1.                  1 2 ,2 2 ,3 2 ,4 2 ,… To execute a root from 1 to 10, the piece of code below has to run program root integer :: a,b print *, 'This program will calculate each number after each other' do i= 1,10   print *, 'Please enter your value' read *, a a=a**2 print *, a end do end program root

FIBONACCI IN FORTRAN

1.                  PROGRAM FIBONACCI The piece of code below is meant to execute Fibonacci expression from 1 – 10 program fibonacci !this program will print fibonacci expression from 1 to 10     integer :: a,b,c,e print*, 'Please enter you first after 1     read*, a print*, 'Please enter your common ratio after 1'     read *, b print*, 'Please enter your last term'     read *, c    e=1     e=e*b    print *, 0    print *, 1    print *, 1 do i=a,c,e     write (*,*) i   end do end program Fibonacci

GEOMETRIC PROGRESSION IN FORTRAN

1.                  GEOMETRIC PROGRESSION This program is set to execute geometric progression. program Geometric !This program solve Arithemetic Progression implicit none          integer :: a,b,c,e,i !a is first term !b is commnon ratio !c is last term !e is value equation print*, 'Please enter you first term'     read*, a print*, 'Please enter your common ratio'     read *, b print*, 'Please enter your last term'     read *, c    e=1 e=e*b do i=a,c   print *, i   end do end program Geometric

ARITHMETIC SERIES AND PROGRESSION IN FORTRAN

The program below when run is expected to solve arithmetic series according to the data requested from the user. program Arithemetic !This program will calculate Arithemetic Series implicit none           integer :: i,a,b           integer :: c !a is first number !b is the increment !c is the number of terms !i is the relation of do-loop print*, 'Please enter your first term'      read *, a print*, 'please enter your increment term'      read *, b print*, 'please enter the last term'      read *, c           do i=a,c,b                print*, i           end do end program Arithemetic You only have to follow the steps very well