class jamesprogram { public static void main(String args[]){ int frogs, horses, animals; frogs =7; horses=2; animals=frogs%horses; System.out.println(animals); } }
This program returns 1, because the modulus % finds the remainder. 2 goes into 7, 3 times, with a remainder 1.