Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 3 задача из хаск.1
- myiter :: Int -> Int -> Bool
- myiter a b =
- if a >= b
- then False
- else (if mod b a == 0
- then True
- else myiter (a+1) b)
- isPrime :: Int -> Bool
- isPrime 1 = False
- isPrime 0 = False
- isPrime a = not (myiter 2 a)
- --5 задача из хаск.1
- maxRoot :: Int -> Int -> Int -> Double
- maxRoot a b c =
- if (b^2 - 4*a*c) < 0
- then 0/0
- else (if (b^2 - 4*a*c) == 0
- then ( (-b)/(2*a))
- else (max((((-b)+(sqrt(b^2 - 4*a*c)))/(2*a)) (((-b)-(sqrt(b^2 - 4*a*c)))/(2*a))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement