PROGRAM Projectile
!---------------------------------------------------------------------------------
!	This program calculates the velocity and height of a projectile
!	given its initial height, initial velocity, and constnat
!	acceleration. Identifiers used are :
!
!	InitialHeight		: initial height of projectile (meters)
!	Height				: height at any time (meters)
!	InitialVelocity		: initial vertical velocity (m/sec)
!	Velocity				: vertical velocity at the time (m/sec)
!	Acceleration		: vertical acceleration (m/sec/sec)
!	Time					: time since launch (seconds)
!---------------------------------------------------------------------------------

	IMPLICIT NONE

	REAL :: InitialHeight, Height, InitialVelocity, Velocity, &
				Acceleration = -9.80665, &
				Time

	! Obtain values for InitialHeight, InitialVeloc, and Time
	PRINT *, "Enter the initial height (m) and velocity (m/sec):"
	READ *, InitialHeight, InitialVelocity
	PRINT *, "Enter time in seconds at which to calculate height and velocity:"
	READ *, TIME

	! Calculate the height and velocity
	Height = 0.5 * Acceleration * Time ** 2 &
				+ InitialVelocity * Time + InitialHeight
	Velocity = Acceleration * Time + InitialVelocity

	! Display Velocity and Height
	PRINT *, "At time", Time, "seconds"
	PRINT *, "the velocity velocity is", Velocity, "m/sec"
	PRINT *, "and the height is", Height, "meters"

	pause
End PROGRAM Projectile



 
 

'노트 > Fortran 연습' 카테고리의 다른 글

Program 3.4. 오염지수 3  (0) 2014.04.06
Program 3.3. 오염지수 2  (0) 2014.04.06
Program 3.2. 오염지수  (0) 2014.04.06
Program 3.1. 이차 방정식  (0) 2014.04.06
Program 2.Exercise6.2. 온도 변환 (2nd Version)  (0) 2014.03.23
Program 2.Exercise6.1. 온도 변환 (1st Version)  (0) 2014.03.23
Program 2.Exercise5  (0) 2014.03.23
Program 1.Exercise10  (0) 2014.03.22
Program 1.1. 방사성 물질 감쇠  (0) 2014.03.22
Hello World  (0) 2014.03.04

+ Recent posts