Created
December 18, 2011 10:13
-
-
Save omegatakuma/1492941 to your computer and use it in GitHub Desktop.
nからnnまでの3と4の公倍数を求めるだけのプログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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