How to check if one number is multiple of another in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        int num1 = 36;
        int num2 = 6;

        System.out.println((num1 % num2 == 0) ? "yes" : "no");
    }
}



/*
run:
 
yes
 
*/

 



answered Jun 28, 2022 by avibootz

Related questions

1 answer 137 views
1 answer 112 views
1 answer 111 views
1 answer 106 views
1 answer 119 views
1 answer 96 views
1 answer 116 views
...