HW4_solutions

HW4_solutions - PROBLEM 4.5 PROGRAM FIBON IMPLICIT NONE...

• Notes
• 3

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

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

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

END ----------------------------------- PROBLEM 4.17: program nmbrs implicit none *This program reads a set of numbers from the user, counts them, *calculates the mean, variance, and standard deviation of the set of *numbers.
This is the end of the preview. Sign up to access the rest of the document.
• Spring '09
• Dabdub

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern