Program to check whether a number is divisible by 10 in java

There are following way to check whether a number is divisible by 10 in java.

  • First we create a test() method with argument type.
  • Now given number is divided by 10 and storing value in a dt variable.
  • Inside if condition, check if dt==0 then return true and given number is divided by 10 else not.
				
					public class DividedBy10 {
	public static void test(int j) {
		int dt = j % 10;
		if (dt == 0) {
			System.out.println("Number is divided by 10");
		} else {
			System.out.println("it is not divided by 10");
		}
	}

	public static void main(String[] args) {
		int value = 143000;
		test(value);
	}
}
				
			

Output :-
Number is divided by 10