Java examples for Language Basics:Operator
how to use Java modulus operator (%).
public class Main { public static void main(String[] args) { /*from w w w . j a v a2 s. c om*/ System.out.println("Java Modulus Operator example"); int i = 50; double d = 32; System.out.println("i mod 10 = " + i%10); System.out.println("d mod 10 = " + d%10); } }