The modulus operator,% ,returns the remainder of a division operation.It can be applied to floating-point types as well as integer types. The following example program demostrates the %:
//Demostrates the % operator.
public static void main(String args)
System.out.println(“x mod 10=”+x%10);
System.out.println(“y mod 10=”+y%10);