import java.util.*; public class lianxi72_4 { public static void main (String [] args){ Scanner inport =new Scanner(System.in); System.out.println("请输入一个整数"); int math =inport.nextInt(); if (math % 3 == 0 && math % 5== 0) { System.out.println("该数是3或5倍数"); }else if (math %3==0) { System.out.println("该数是3倍数"); }else if (math %5==0) { System.out.println("该数是5倍数"); }else { System.out.println("该数不能被3和5中的任何一个数整除"); } } }
Java-第三章-从键盘输入整数判断是3和5的倍数!,布布扣,bubuko.com
原文地址:http://lianlian520.blog.51cto.com/9018432/1423972