- #1
Md. Abde Mannaf
- 20
- 1
Code:
!subprogram for combination
!Author:: mannaf
function fact(n)
implicit none
integer ::fact,n,i
fact=1
do i=1,n
fact=fact*i
end do
return
end
program comb
implicit none
integer ::fact,n,r,combination
print*,'enter the value of nCr'
read*,n,r
if ( n>=0 .and. r>=0 .and. n>=r) then
combination=fact(n)/(fact(n-r)*fact(r))
print*,'combination is =',combination
else
print*,'combination is not possible '
end if
end program
when we input n=13,r=2 then result is not correct? how to solve?