15 lines
312 B
Haskell
15 lines
312 B
Haskell
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
|