use ifcore  ! or: dflib
integer(2) i1,i3
logical pressed

i1 =32767_2

print '(a)',' Input an Integer(2) to be added to 32767 (0 to EXIT)'

100 print '(/, a, \)',' Integer(2): '
read *, i2

if(i2==0) then
goto 500    ! EXIT

elseif(.NOT.(i2<=32767 .and. i2>=-32768)) then
print '(a, /)',' * Error range: -32768<= INTEGER(2) <= 32767'
goto 100

else
i3= i1 + int2(i2)

	if(i2 >0) then
	print '(a, I6, a, I6)',' 32767 +', i2, ' = ', i3
	else
	print '(a, I6, a, I6)',' 32767 -', -i2, ' = ', i3
	endif
goto 100
endif

500 continue
write(*, '(/,a)') 'Apasa orice tasta'
DO WHILE (.NOT. pressed)   
pressed = PEEKCHARQQ ( )
END DO

end
