import java.util.Scanner; public class FizzBuzz { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); for(int i = 1; i <= n; i++){ System.out.println(judge(i));//数値をメソッドに渡す } } public static String judge(int i){ String result = (i%15 == 0)?"FizzBuzz": //3,5の倍数の場合 (i%5 == 0)?"Buzz": //5の倍数 (i%3 == 0)?"Fizz": //3の倍数 Integer.toString(i);//全てに一致しない場合 return result; } }