this is the program which gives output as " number is divisible by 5 and 6" or it will give "number is divisible by 5(6)" or "not divisible by either 5 and 6".

the problem is when i entered 5 it gave "Number is divisible by 6" and when i enter 30 it gave "Number is not divisible either by 5 and 6"

Kindly tell me what is wrong in it? I want to write this code by using if statements only.

import javax.swing.JOptionPane; public class Divisibility { public static void main(String[] args) { String number=JOptionPane.showInputDialog(null, "Enter any number"); int no=Integer.parseInt(number); if(no/5==0&&no/6==0) { JOptionPane.showMessageDialog(null, "The number is divisible by both 5 and 6"); } else if(no/5==0^no/6==0) { if(no/5==0) JOptionPane.showMessageDialog(null, "The number is divisible by 5"); else JOptionPane.showMessageDialog(null, "The number is divisible by 6"); } else JOptionPane.showMessageDialog(null, "The number is not divisible by either 5 or 6"); } }