4. Write a Java program to check whether a number is divisible by 5 and 11 or not.
Solution :-
Static
class div5_11
{
public static void main(String args[])
{
int no1=-50;
if((no1 %5==0)&&(no1 %11==0))
{
System.out.println("The number is Divisible by 5 and 11 :- "+no1);
}
else
{
System.out.println("The number is not Divisible by 5 and 11 :- "+no1);
}
}
}
Output :-
Dynamic
Solution :-
import java.util.*;
class div5_11
{
public static void main(String args[])
{
int no1;
Scanner out = new Scanner(System.in);
System.out.println("Enter the first number :- ");
no1 = out.nextInt();
if((no1 % 5 ==0)&&(no1 %11 == 0))
{
System.out.println("The number is Divisible by 5 and 11 :- "+no1);
}
else
{
System.out.println("The number is Divisible by 5 and 11 :-
"+no1);
}
}
}
Output :-