how do i solve this problem in haskell?
" A machine selects an integral number ( more than or equal to one and less than or equal to N) with equal probability at one operation. Find the excepted probability in which the median of three integral number selected by three times operation with the machine above is K. (K is also integral number) "
first i tried this and got this error:
main = do
n <- getLine
k <- getLine
print 1+(n-1)+(n-1)*(n-2)/n^3
q4.hs:7:18: Couldn't match type ‘[Char]’ with ‘IO ()’ Expected type: IO () Actual type: String In the first argument of ‘(-)’, namely ‘n’ In the second argument of ‘(+)’, namely ‘(n - 1)’
q4.hs:7:24: Couldn't match type ‘[Char]’ with ‘IO ()’ Expected type: IO () Actual type: String In the first argument of ‘(-)’, namely ‘n’ In the first argument of ‘(*)’, namely ‘(n - 1)’
q4.hs:7:30: Couldn't match type ‘[Char]’ with ‘IO ()’ Expected type: IO () Actual type: String In the first argument of ‘(-)’, namely ‘n’ In the second argument of ‘(*)’, namely ‘(n - 2)’
q4.hs:7:35: Couldn't match type ‘[Char]’ with ‘IO ()’ Expected type: IO () Actual type: String In the first argument of ‘(^)’, namely ‘n’ In the second argument of ‘(/)’, namely ‘n ^ 3’
how do i solve this problem? sorry i'm very new to haskell(and english too.) thank you.