HW4_solutions

HW4_solutions - PROBLEM 4.5 PROGRAM FIBON IMPLICIT NONE INTEGER I N NEW OLD1 OLD2 Prompts user to enter the amount of Fibonacci numbers

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
PROBLEM 4.5: PROGRAM FIBON IMPLICIT NONE INTEGER I, N, NEW, OLD1, OLD2 * Prompts user to enter the amount of Fibonacci numbers PRINT*, 'PLEASE ENTER HOW MANY FIBONACCI NUMBERS YOU WANT' PRINT*, 'CALCULATED, BUT DO NOT EXCEED 46' READ*, N * Calculates the Fibonacci pattern and prints to screen OLD1 = 1 OLD2 = 1 DO I=1,N PRINT*, OLD1 NEW = OLD1 + OLD2 OLD1 = OLD2 OLD2 = NEW END DO END ----------------------------------- PROBLEM 4.15: program main integer count real prcent, height, initH real tdist, dist print*, 'What is the initial height?' Read*, initH Height = initH Print*, 'Enter the constant bounce percentage:' Read*, prcent tdist = initH count = 0 DO While (height .GE. 0.001*initH) height = prcent* height dist = 2.*height TDist = TDist + Dist Count = Count + 1 Print*, 'Bounce', count, ' has a height of:', height Print*, 'distance traveled during bounce:', dist Print*, 'total distance:', Tdist PRINT*, ' ' END DO
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
END ----------------------------------- PROBLEM 4.17: program nmbrs implicit none
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/10/2009 for the course MAE 10 taught by Professor Dabdub during the Spring '09 term at UC Irvine.

Page1 / 3

HW4_solutions - PROBLEM 4.5 PROGRAM FIBON IMPLICIT NONE INTEGER I N NEW OLD1 OLD2 Prompts user to enter the amount of Fibonacci numbers

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online