Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ggcd :: Int->Int->Int
- ggcd x y =
- if (x == 0) || (y == 0) then
- abs (x - y)
- else
- if (mod x y) == 0 then
- abs y
- else
- ggcd y (mod x y)
- is_prime :: Int->Int->Bool
- is_prime x y =
- if fromIntegral(y) < (sqrt $ fromIntegral(x)) then
- if (mod x y) == 0
- then False
- else is_prime x (y + 1)
- else True
- prime :: Int->Bool
- prime x =
- if x == 0 then False
- else
- is_prime (abs x) 2
- int_rvrs :: Int->Int->Int
- int_rvrs x res=
- if (x > 0)
- then int_rvrs (div x 10) (res * 10 + (mod x 10))
- else res
- int_reverse :: Int->Int
- int_reverse x =
- int_rvrs x 0
- ko :: Double->Double->Double->Double
- ko a b c =
- if a == 0
- then (-c)/b
- else let d = b*b - 4*a*c
- in
- if d >= 0
- then max (((-b)+sqrt(d))/(2*a)) (((-b)-sqrt(d))/(2*a))
- else error("Нет корней")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement