Quoted from JohnCampbell
Is this what you wanted to do ?
program test
implicit none
real :: ngamma,n1,n2
n1=5
n2=5
ngamma=0
do
ngamma=ngamma+1
if ( sqrt(n1+n2) >= ngamma ) then
print *,'gamma_n can be',ngamma
else
exit
end if
end do
end program test
Thank you very much! It works very well. However, I want to put it into another program, the FORTRAN said the error 328. Part of my code is
program simul
implicit none
real :: r1,r2,c1,c2,e,x,pa,pb,sumpc,sumpm,gamma,ker,hd,d,dhatp,dhat,pbsq,kf,sumpuj,nnn,maxpd,w,ngamma
real :: yy1,yy2,e1
integer, parameter :: NN = 1000
integer, parameter :: pi = 3.1415926
real,dimension(NN) :: xp,y,xr,yr,pu,rhok,pd,puj,cp
integer :: i,n1,n2,n,j,m,k,nrep
integer,dimension(1) :: place
print *,'input numbers before change point to continue'
read *, n1
print *,'input numbers after change point to continue'
read *, n2
print *,'input coefficient of relationship before change point to continue'
read *, r1
print *,'input coefficient of relationship after change point to continue'
read *, r2
ngamma=0
do
ngamma=ngamma+1
if ( ngamma<=sqrt(n1+n2)) then
print *,'gamma_n can be',ngamma
else
exit
end if
end do
print *,'input gamma_n'
read *, gamma