Decode School

Decode School - The School for Problem Solvers

Welcome to my blog. Subscribe and get my latest blog post in your inbox.

Java Program to find modulus of two numbers

Get two integer numbers, divide both the integers and display  the remainder.

Sample Input 1:

6 5

Sample Output 1:


Sample Input 2:

28 4

Sample Output 2:


Program or Solution


Program Explanation

Get two integers Input1 and Input2 (using scanner class) divide Input1 by Input2 , then store quotient in mod (mod=Input1%Input2 , Note "%" operator gives remainder) print the value of mod (using system.out.println)