Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reverseOrdStuff :: Int -> Int
- reverseOrdStuff n =
- if n < 10
- then n
- else if lastDigit < secondToLastDigit
- then (paddedLastDigit + restResult)
- else lastDigit
- where
- lastDigit = n `mod` 10
- numberTail = n `div` 10
- secondToLastDigit = numberTail `mod` 10
- restResult = reverseOrdStuff numberTail
- paddedLastDigit = lastDigit * (10 ^ (floor $ logBase 10 restResult))
- main :: IO()
- main = do
- print (round 2.4399)
- print (10 ** 2)
- -- print (reverseOrdStuff 32763)
- print (10 ^ (floor $ logBase 10 243))
Advertisement
Add Comment
Please, Sign In to add comment