Advertisement
KillianMills

exercise1.hs

Oct 2nd, 2014
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- CA320 Computability and Complexity
  2. --
  3. -- Killian Mills
  4. --
  5. --:load "H:/Complexity/exercise1.hs"
  6. -- how to load in the command line of haskell
  7. --
  8. -- week 8 lab exam
  9. -- about 4/5 questions raising in difficulty
  10. --
  11. -- week 7 assignment
  12.  
  13. cube :: Int -> Int -- cube takes in int, gives an int
  14. cube x = x * x * x -- cuber x = x by x by x
  15.  
  16. edge, volume :: Int -- both are ints
  17. edge = 3 -- edge = 3, set to 3
  18.  
  19. volume = cube edge -- volume = the cube of edge, cube of 3
  20.  
  21. surfaceArea :: Float -> Float -- surfaceArea takes in float, gives float
  22. surfaceArea r = 4.0 * pi * r^2 -- radius = 4.0 by pi by radius raised to 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement