Example:
package javaapplication;
/**
*
* @author Rathorji
*/
public class JavaApplication {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("Modulus of the no is:");
int age = 50;
double old_age = 32;
System.out.println("age mod 10 = " + age % 10);
System.out.println("old_age mod 10 = " + old_age % 10);
}
}
output:
run:
Modulus of the no is: age mod 10 = 0 old_age mod 10 = 2.0 |