Skip to content

Instantly share code, notes, and snippets.

@omegatakuma
Created December 18, 2011 10:13
Show Gist options
  • Save omegatakuma/1492941 to your computer and use it in GitHub Desktop.
Save omegatakuma/1492941 to your computer and use it in GitHub Desktop.
nからnnまでの3と4の公倍数を求めるだけのプログラム
sumTo x = (read :: String -> Int) x
getInt = do m <- getLine ; return (sumTo m)
act n = do
if (n`mod` 3 == 0) && (n`mod`4 == 0)
then print n
else return ()
cal i i2 keisan = do
keisan i
if i /= i2
then cal (i+1) i2 keisan
else return ()
main = do
putStrLn "始めの数は? : "
i <- getInt
putStrLn "最後の数は? : "
i2 <- getInt
cal i i2 act
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment