Created
January 5, 2015 07:42
-
-
Save takanakahiko/f093cd737aca0c2cb9b9 to your computer and use it in GitHub Desktop.
FizzBuzzです。もはや説明は要らない。(1.5)
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
public class FizzBuzz{ | |
public static void main(String[] args){ | |
int n = Integer.parseInt(System.console().readLine("いくつまでやりますか? ")); | |
for(int i = 1; i <= n ;i++ ){ | |
if(i%3==0) | |
System.out.print("Fizz"); | |
if(i%5==0) | |
System.out.print("Buzz"); | |
if(i%3!=0 && i%5!=0) | |
System.out.print(i); | |
System.out.print(" "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment