fork download
  1. !--------------------------------------------------
  2. !Compiled by Ted Hertel
  3. !ENGR 225 Fall 2010
  4. !--------------------------------------------------
  5.  
  6.  
  7. !declare variables
  8. module types
  9. real, parameter::dp=selected_real_kind(15)
  10. end module types
  11.  
  12.  
  13. program dangerousmath
  14.  
  15. implicit none
  16. real :: a, b, x, mu, c
  17. integer :: i, k, n = 9
  18. character (10) :: name
  19. a = 3
  20. b = (n+3)/5
  21. x = 5.75
  22. i = 3.141959
  23. k = x/2.0
  24. mu = 1./5.75
  25. write (*,*) "Please enter your name."
  26. read (*,*) name
  27. write (*,*) "Hello ", name
  28. write (*,*) a,b,x,i,k,mu
  29.  
  30. !Enter A and B to calculate C
  31.  
  32. write (*,*) "Enter a value for A and B"
  33. read (*,*) a, b
  34. !calculate c
  35. c = ((a + b) ** 2 - 2 * a * b - b ** 2)/a ** 2
  36. write (*,*) c
  37.  
  38.  
  39. stop
  40. end program dangerousmath
  41.  
Success #stdin #stdout 0s 2620KB
stdin
ted
0.5,888.0

stdout
 Please enter your name.
 Hello ted       
   3.0000000       2.0000000       5.7500000               3           2  0.17391305    
 Enter a value for A and B
  1.00000000