题解 | #牛牛的二三七整除#
牛牛的二三七整除
https://www.nowcoder.com/practice/b2cf0b791245436f8f0591ae9f4c664f
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 int n=in.nextInt(); int count=0; //count用于计数,最后判断是有成立 if(n%2==0){ count++; System.out.print(2+" "); } if(n%3==0){ count++; System.out.print(3+" "); } if(n%7==0){ count++; System.out.print(7+" "); } if(count==0) System.out.print("n"); } }