
write a program that prompts the user to enter an integer and determines whether it is divisible by 5 and 6, whether it is divisible by 5 or 6, and whether it is divisible by 5 or 6, but not both. for example, if your input is 10, the output should be is 10 divisible by 5 and 6? false is 10 divisible by 5 or 6? true is 10 divisible by 5 or 6, but not both? true

Hi Friend,
Try this:
import java.util.*;
class NumberProgram2{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.print("Enter Number: ");
int num=input.nextInt();
boolean check1=false,check2=false;
if((num%5==0)||(num%6==0)){
check1=true;
}
if((num%5==0)&&(num%6==0)){
do{
System.out.print("Enter another no: ");
num=input.nextInt();
}
while((num%5==0)&&(num%6==0));
check2=false;
}
System.out.println("Is "+num+" divisible by 5 and 6? "+check2);
System.out.println("Is "+num+" divisible by 5 or 6? "+check1);
System.out.println("Is "+num+" divisible by 5 or 6? "+check1);
}
}
Thanks