Skip to content

Commit

Permalink
chore: make examples ci friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
vil02 committed Sep 19, 2024
1 parent 99ac035 commit f017a0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
12 changes: 3 additions & 9 deletions examples/maths/euclid_gcd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ program euclid_gcd_program
use gcd_module
implicit none
integer :: a, b, val
character(len=1024) :: msg
integer :: istat

print *, "Enter the two numbers (+ve integers): "
read(*, *, iostat=istat, iomsg=msg) a, b
if (istat /= 0) then
write(*, fmt='(2A)') 'error: ', trim(msg)
stop 1
end if
a = 56
b = 98

val = gcd(a, b)
print *, 'The greatest common divisor is: ', val
print *, 'The greatest common divisor of ', a, ' and ', b, ' is: ', val

end program euclid_gcd_program
9 changes: 2 additions & 7 deletions examples/maths/fibonacci.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ program example_fibonacci
implicit none
integer :: n

print *, 'Enter a number: '
read *, n
if (n <= 0) then
print *, 'Number must be a positive integer.'
stop 1
end if
n = 7

print *, 'The Fibonacci number for the specified position is:'
print *, 'The Fibonacci number for the position', n, ' is:'
print *, 'Recursive solution: ', fib_rec(n)
print *, 'Iterative solution: ', fib_itr(n)

Expand Down

0 comments on commit f017a0c

Please sign in to comment.