Skip to content

Instantly share code, notes, and snippets.

@takanakahiko
Created January 5, 2015 07:42
Show Gist options
  • Save takanakahiko/f093cd737aca0c2cb9b9 to your computer and use it in GitHub Desktop.
Save takanakahiko/f093cd737aca0c2cb9b9 to your computer and use it in GitHub Desktop.
FizzBuzzです。もはや説明は要らない。(1.5)
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