program zbrak_main integer n, nb_max, nb parameter (nb_max = 50) real fx, x1,x2,xb1(nb_max),xb2(nb_max) external fx write(*,*) 'What is the range (two numbers) to find roots ?' read (*,*) x1,x2 write(*,*) 'How many internals to divide and check for roots ?' read (*,*) n write(*,*) 'Maximum number of expected roots ? (no more than 50)' read (*,*) nb call zbrak(fx,x1,x2,n,xb1,xb2,nb) write(*,*) 'Answers and range of the roots found' do i=1,nb write(*,102) xb1(i), xb2(i) end do 102 format (1x,'range is:',e12.3, ' and ', e12.3) end function fx(x) real fx,x c fx = x**3 fx = 7*sin(x) + x end