handout2_solutions

handout2_solutions - solutions.txt Tue Oct 11 08:17:44 2011...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: solutions.txt Tue Oct 11 08:17:44 2011 1 1: 2:******************************************* 3:./exercise4/factorial.f90 4: 5:PROGRAM factorial 6:!*** calculate the first factorials of the numbers 1 -> 8 7: 8: IMPLICIT NONE 9: 10: INTEGER :: a, b=1 11: 12: DO a = 1, 8 13: b = a*b 14: PRINT*, "factorial " ,a, " = " ,b 15: END DO 16: 17:END PROGRAM factorial 18: 19:******************************************* 20: 21: 22:******************************************* 23:./exercise5/nested_loop.f90 24: 25:PROGRAM nested_loop 26:!** 27:!** Program to demonstrate nested loops 28:!** 29: 30: IMPLICIT NONE 31: 32: INTEGER :: loop1,loop2,ans=0 33: 34: DO loop1=10,19 35: DO loop2=21,30 36: ans=ans+loop1*loop2 37: END DO 38: END DO 39: 40: PRINT*, "Answer is" ,ans 41: 42: !** Ans = 36975 43: 44:END PROGRAM nested_loop 45: 46:******************************************* 47: 48: 49:******************************************* 50:./exercise2/quadratic_real.f90 51: 52:!**************************************************************************** 53:!** 54:!** PROGRAM: Quad 55:!** 56:!** PURPOSE: Examine a quadratic equation 57:!** 58:!**************************************************************************** 59: 60:PROGRAM quad 61: 62:!** 63:!** Program to investigate a quadratic equation (y=a*x*x+b*x+c) 64:!** 65: 66: IMPLICIT NONE !** Force explicit declaration of all variables 67: solutions.txt Tue Oct 11 08:17:44 2011 2 68: !** Declare required variables 69: LOGICAL :: check 70: REAL :: a=-3,b=6,c=1 !** Define the quadratic a*x*x+b*x+cREAL :: a=-3,b=6,c=1 !...
View Full Document

Page1 / 2

handout2_solutions - solutions.txt Tue Oct 11 08:17:44 2011...

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

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