Write a programme that demonstrate modulus operator

Category : Java | Sub Category : Operator | By Prasad Bonam Last updated: 2020-09-28 13:17:22 Viewed : 488


Write a programme that demonstrate modulus operator


Source Code:

 /**

 * Write a programme that demonstrate modulus operator

 *

 */

public class modulas { // class name

     public static void main(String arg[]) { // main method

           int x = 67; // initialize and declare x

           double y = 67.25; // initialize and declare y

           System.out.println("x mod 10 = " + x % 10); // print modulus of x

           System.out.println("y mod 10 = " + y % 10); // print modulus of y

     } // end main method

 

}// end class



Search
Related Articles

Leave a Comment: