fork download
  1. PROGRAM Circle
  2. !----------------------------------------------------------------------------
  3. ! Dakota Gillette
  4. ! This program calculates the Radius, Circumference, and Area of a circle given the circle's Diameter.
  5. ! Variables used are:
  6. ! Diameter : Diameter of the circle
  7. ! Radius : Radius of the circle
  8. ! Circumference : Circumference of the circle
  9. ! Area : Area of the circle
  10. !
  11. ! Input: Diameter
  12. ! Output: Radius, Circumference, Area
  13. !-----------------------------------------------------------------------------
  14.  
  15. IMPLICIT NONE
  16. REAL :: Diameter, Radius, Circumference, Area, Pi
  17.  
  18. Pi = 3.14
  19.  
  20. ! Get value for Diameter
  21.  
  22. WRITE (*,*) "Enter a value for the Diameter of the circle:"
  23. READ (*,*) Diameter
  24.  
  25. ! Compute the Radius of the circle from the specified Diameter.
  26. Radius = Diameter * (0.5)
  27.  
  28. ! Display Radius.
  29. WRITE (*,*) "Radius =", Radius
  30.  
  31. ! Compute the Circumference of the circle from the specified Diameter.
  32. Circumference = Radius * (2) * (Pi)
  33.  
  34. ! Display Circumference
  35. WRITE (*,*) "Circumference =", Circumference
  36.  
  37. ! Compute the Area of the circle from the specified Diameter.
  38. Area = (Radius ** (2)) * (Pi)
  39.  
  40. ! Display Area.
  41. WRITE (*,*) "Area =", Area
  42.  
  43.  
  44. END PROGRAM
Success #stdin #stdout 0.01s 2620KB
stdin
5
stdout
 Enter a value for the Diameter of the circle:
 Radius =   2.5000000    
 Circumference =   15.700001    
 Area =   19.625000