Advertisement
Guest User

Untitled

a guest
May 15th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !gfortran, gcc version 5.4.0 20160609
  2.  
  3. program numberThree
  4.     real :: z, x, a
  5.    
  6.     x = 0.74
  7.     a = 3
  8.     z = equasion(x, a)**2 + 0.4 * equasion(x, a)
  9.    
  10.     print *, z
  11. end program numberThree
  12.  
  13. function equasion(x, a)
  14.  
  15.     real :: equasion
  16.    
  17.     real :: x
  18.     real :: a
  19.    
  20.     if (x < 1) then
  21.         equasion = sqrt(-a * x + 2)
  22.     else if(x >= 12) then
  23.         equasion = log(x ** 2)
  24.     else
  25.         equasion = abs(sin(x ** 3))
  26.     endif
  27. end function equasion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement