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

Comments

Post a Comment

Popular posts from this blog

'To accomplish great things, we...O.F. AKEREDOLU

BIOGRAPHY OF WIZBLISS