This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ELSE IF (score .GE. 80.) THEN grade = 'B' ELSE grade = 'F' ENDIF RETURN END 3.) LOGICAL FUNCTION odd(x) INTEGER x odd = MOD(x,2) .NE. 0 RETURN END PROBLEM 3 REAL FUNCTION xSQRT(A,G) REAL A,G, Gnew diff = 1. DO WHILE (abs(diff) .GT. 0.00001) Gnew = ((A/G)+G)/2. diff = Gnew-G G = Gnew ENDDO xSQRT = Gnew RETURN END PROBLEM 4 PROGRAM root EXTERNAL f REAL a, b, c, f PRINT*, 'Enter values for a and b' READ*, a, b c = (a+b)/2. DO WHILE (abs(f(c)) .GT. 0.001) IF (f(a)*f(c) .LT. 0) THEN b = c ELSE a = c ENDIF c = (a+b)/2. ENDDO PRINT*, 'x = ', c END...
View Full 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.
- Spring '09