implicit none
integer :: i, x, y, n, m
integer, dimension(:), allocatable :: integer_pair
integer, dimension(:), allocatable :: result
print*, “Enter the integer pair you want to calculate.”
read*, n
print*, “Enter the integer pair.”
read*, integer_pair
m=n2
do i=1,m,2
result=diff_pair (x,y)
enddo
print, (result(i), i=1,n)
contains
function diff_pair (a,b)
integer :: a,b,diff_pair
if (a>=b) diff_pair=a-b
if (a<b) diff_pair=b-a
end function diff_pair
end program pair_difference
When I run the code, it runs, but there is no answer because program received signal sigsegv segmentation fault - invalid memory reference is displayed. I don’t know what is the error. please Help.
…and it also looks like you are a beginner to programming in general. This is not the appropriate place for your question; you need to learn how to program elsewhere first.