frostblooded

Untitled

Jan 4th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. reverseOrdStuff :: Int -> Int
  2. reverseOrdStuff n =
  3.     if n < 10
  4.         then n
  5.         else if lastDigit < secondToLastDigit
  6.             then (paddedLastDigit + restResult)
  7.             else lastDigit
  8.                 where
  9.                     lastDigit = n `mod` 10
  10.                     numberTail = n `div` 10
  11.                     secondToLastDigit = numberTail `mod` 10
  12.                     restResult = reverseOrdStuff numberTail
  13.                     paddedLastDigit = lastDigit * (10 ^ (floor $ logBase 10 restResult))
  14.  
  15. main :: IO()
  16. main = do
  17.     print (round 2.4399)
  18.     print (10 ** 2)
  19.     -- print (reverseOrdStuff 32763)
  20.     print (10 ^ (floor $ logBase 10 243))
Advertisement
Add Comment
Please, Sign In to add comment