diff options
Diffstat (limited to 'rsa.f90')
| -rw-r--r-- | rsa.f90 | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -0,0 +1,26 @@ +program rsa + implicit none + integer :: n, m + + print *, "Enter numbers to compute gcd:" + read(*,*) n, m + + print *, "gcd: ", gcd(n,m) + + contains + + recursive function gcd(n,m) result(x) + implicit none + integer, intent(in) :: n,m + integer :: x + + if (n == 0) then + x = m + else if (m == 0) then + x = n + else + x = gcd(m, mod(n,m)) + end if + end function gcd + +end program rsa |
