用FORTRAN求三个数中的最大数和最小数

2024-12-12 11:16:45
推荐回答(2个)
回答1:

program MinMax

implicit none

integer :: a
integer :: b
integer :: c
integer :: min
integer :: max

read *, a, b, c

min = a
max = a

if(min > b) then
min = b
else if(max < b) then
max = b
end if

if(min > c) then
min = c
else if(max < c) then
max = c
end if

print *, "min = ", min, " max = ", max

end program MinMax

回答2:

MIN()和MAX()函数