Created
July 11, 2012 10:01
-
-
Save skRyo/3089396 to your computer and use it in GitHub Desktop.
fizzbuzz
This file contains hidden or 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
import java.io.*; | |
public class fizzbuzz { | |
public static void main(String[] args) { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
try { | |
String line = reader.readLine(); | |
int x = Integer.parseInt(line); | |
for(int i=1; i <= x; i++){ | |
if(i%3==0 && i%5==0){ | |
System.out.println("FizzBuzz"); | |
}else if(i%3==0){ | |
System.out.println("Fizz"); | |
}else if(i%5==0){ | |
System.out.println("Buzz"); | |
}else{ | |
System.out.println(i); | |
} | |
} | |
}catch (IOException e){ | |
System.out.println("fuck??"); | |
}finally { | |
try { | |
reader.close(); | |
} catch (IOException e) { | |
System.out.println("fuck!!"); | |
} | |
} | |
} | |
} |
書いてみた!
素敵です。おkだと思います。
これをプログラムしてください
http://ja.wikipedia.org/wiki/%E9%96%8F%E5%B9%B4
これです
西暦年が4で割り切れる年は閏年
ただし、西暦年が100で割り切れる年は平年
ただし、西暦年が400で割り切れる年は閏年
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
readerのクローズ漏れがあるとおもわれ