## Write a Java-program to check the given number is valid or invalid(value must divisible by 2 and 3 not 4 using 2 conditions)

#### Write a Java-program to check the given number is valid or invalid(value must divisible by 2 and 3 not 4 using 2 conditions)

##### Program
public class Main
{
public static void main(String args[])
{
int x=10;
if(x%6==0 && x%4!=0)
{
System.out.println("Valid Number");
}
else
{
System.out.println("Invalid Number");
}
}
}

Output:

Invalid Number

##### Using CommandLine Arguments
public class Main
{
public static void main(String args[])
{
int x;
x=Integer.parseInt(args[0]);
if(x%6==0 && x%4!=0)
{
System.out.println("Valid Number");
}
else
{
System.out.println("Invalid Number");
}
}
}

Output:

Invalid Number

##### Using Scanner Class
import java.util.*;
public class Main
{
public static void main(String args[])
{
int x;
Scanner s=new Scanner(System.in);
System.out.println("Enter x Value");
x=s.nextInt();
if(x%6==0 && x%4!=0)
{
System.out.println("Valid Number");
}
else
{
System.out.println("Invalid Number");
}
}
}

Output:

Enter x value
10
Invalid Number