HW3.12

时间:2021-10-05 05:18:19

HW3.12

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.print("Enter a number: ");
         int number = input.nextInt();

         input.close();

         if(number % 5 == 0 && number % 6 == 0)
             System.out.println(number + " is divisible by both 5 and 6");
         else if(number % 5 !=0 && number % 6 != 0)
             System.out.println(number + " is not divisible by either 5 or 6");
         else
             System.out.println(number + " is divisible by 5 or 6, but not both");
     }
 }

相关文章