If you want to check if the integer value is a multiple of a number in Java , you can use the modulus (%) operator . If you get the result as zero , then it is considered as multiple of a number.
How to Check if Integer is a multiple of a number in Java?
Below is a sample code snippet demonstrating the usage of the modulus operator to find out if the given number is a multiple of a number.
public class Main { public static void main(String[] args) { int input = 5; int result = input % 5; System.out.println(result); } }
Leave a Reply