The sum of integers between 1 and n is given by sigman i1 i
Solution
hw05_01a.f95
//in this program summation is done based on formula...
PROGRAM summation
      IMPLICIT NONE
      INTEGER n
      print*, \'ENTER THE NUMBER\'
      read*, n
      print*, \'THE NUMBER IS\', n
      PRINT*, sum_n(n) ! etc
     CONTAINS
      RECURSIVE FUNCTION sum_n(N) RESULT(N_sum)
       INTEGER, INTENT(IN) :: N
       INTEGER :: N_sum ! also defines type of fact
        IF (N /= 1) THEN
          N_sum = N + sum_n(N-1)
        ELSE
          N_sum = 1
        END IF
      END function sum_n
     END PROGRAM summation
hw05_01b.f95
//this program is used to find sum using do loop
program looping
 implicit none
 integer :: count, n, number,sum
print*, \'ENTER THE NUMBER\'
 read*, number
 print*, \'THE NUMBER IS\', number
 n = number
 sum = 0
 do count=1,n
 sum = sum + dble(count)
 
 end do
 write (*,*) \' Value of sum is \',sum
 stop
 end program looping
//program for inverse tan series using taylor series
program infiniteSeries
 implicit none
 integer :: n = 1
 real :: degRad = 3.141592653589793 / 180
 real :: atanApprox, atanIntrinsic = 0., mytan = 0., x = 0.
 
 write(*,*)\"Please enter a value in degrees\"
 read(*,*) x
 x = x * degRad
 atanIntrinsic = atan(x)
 do n = 1, 10
     mytan = atanApprox(x,n)
     write(*,*) n, mytan
 end do
 write(*,*) \"Intrinsic function atan() =\", atanIntrinsic
 end program infiniteSeries
real function atanApprox(x,n)
 implicit none
 real :: x, fact ! type of the function fact()
 integer :: n, k, a
atanApprox = 0.
 do k = 0, n
   
     atanApprox = atanApprox + (-1)**k * x**(2*k+1) / fact(2*k+1)
 end do
 end function atanApprox
function fact(a)
 implicit none
 real :: fact
 integer :: a, i
fact = 1.
 do i = 1, a
     fact = fact * i
 end do
 end function fact


