Add tasks
This commit is contained in:
parent
e273e2a7d9
commit
697f4ab914
2
Exercise 1/2.hs
Normal file
2
Exercise 1/2.hs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
main :: IO ()
|
||||||
|
main = putStrLn "Hello world"
|
10
Exercise 1/3.hs
Normal file
10
Exercise 1/3.hs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
putStrLn $ show $ 1 + 2 * (3+4) + 4/2 - 1
|
||||||
|
|
||||||
|
let minutter = 355 :: Int
|
||||||
|
|
||||||
|
let timer = minutter `div` 60
|
||||||
|
let minutterIgjen = minutter `mod` 60
|
||||||
|
|
||||||
|
putStrLn $ show $ show minutter ++ " minutter blir " ++ show timer ++ " timer og " ++ show minutterIgjen ++ " minutter"
|
14
Exercise 1/9.hs
Normal file
14
Exercise 1/9.hs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
input <- promptLine "Skriv inn h: "
|
||||||
|
let h = read input :: Double
|
||||||
|
putStrLn $ show $ tetraederVolum h
|
||||||
|
|
||||||
|
promptLine :: String -> IO String
|
||||||
|
promptLine prompt = do
|
||||||
|
putStr prompt
|
||||||
|
getLine
|
||||||
|
|
||||||
|
tetraederVolum :: Double -> Double
|
||||||
|
tetraederVolum h = sqrt 2 * a / 12
|
||||||
|
where a = 3 / sqrt 6 * h
|
Loading…
Reference in New Issue
Block a user