integer(kind=8)::i,Mutton real(kind=8)::n read *,n i=(sqrt(1+8*n)-1)/2 Mutton=(i**2+i)/2 Mutton2=((i-1)**2+i-1)/2 Mutton3=((i+1)**2+i+1)/2 if(Mutton==n .or. Mutton2==n .or. Murron3==n) then print *,"YES" print *,i else print *,"NO" end if end