Skip to main content

ROOTDO.F95

	PROGRAM ROOTDO
!
! Purpose: prints a list of integers, in descending order,
! and their square roots.
!
	IMPLICIT NONE
	INTEGER::N		! Integer input variable
	INTEGER::I		! DO loop variable
!
	WRITE(*,*)'Enter an integer'
	READ(*,*)N
!  The increment of the DO loop is -1 (I should decrease from N to 1).
!  Use the *-format for printing out the results. Note that the integer should
!  be converted to real before calculating the square root.
	DO I=N,1,-1
	   WRITE(*,*)I,SQRT(REAL(I))
	END DO 			
	STOP
	END PROGRAM ROOTDO