From f017a0c34fab9fec70047ceab75d1d741045cb2c Mon Sep 17 00:00:00 2001 From: vil02 <65706193+vil02@users.noreply.github.com> Date: Thu, 19 Sep 2024 09:58:03 +0200 Subject: [PATCH] chore: make examples ci friendly --- examples/maths/euclid_gcd.f90 | 12 +++--------- examples/maths/fibonacci.f90 | 9 ++------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/examples/maths/euclid_gcd.f90 b/examples/maths/euclid_gcd.f90 index ef4bf64..ccd9f3e 100644 --- a/examples/maths/euclid_gcd.f90 +++ b/examples/maths/euclid_gcd.f90 @@ -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 diff --git a/examples/maths/fibonacci.f90 b/examples/maths/fibonacci.f90 index c9c340d..ed7b3cc 100644 --- a/examples/maths/fibonacci.f90 +++ b/examples/maths/fibonacci.f90 @@ -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)