Lab1_PF
unknown
plain_text
3 years ago
1.0 kB
12
Indexable
import Data.List
myInt = 5555555555555555555555555555555555555555555555555555555555555555555555555555555555555
double :: Integer -> Integer
double x = x+x
--maxim :: Integer -> Integer -> Integer
maxim x y = if (x > y)
then x
else y
max3 x y z = let
u = maxim x y
in (maxim u z)
triple :: Integer -> Integer
triple x = x + x + x
max4 x y z t = let
u = maxim x y
v = maxim z t
in (maxim u v)
patrat x y = x * x + y * y
paritate :: Integer -> String
paritate x = if ( x `mod` 2 == 0)
then "par"
else "impar"
factorial x = if (x == 0 || x == 1)
then 1
else x * factorial(x-1)
factorial' 0 = 1
factorial' 1 = 1
factorial' n = n * factorial'(n-1)
factorial2 n
|n == 0 = 1
|n == 1 = 1
|n < 0 = error "nr negativ"
|otherwise = n * factorial2(n-1)
verificare x y = if( x > y + y)
then True
else FalseEditor is loading...