Modulo or Remainder Operator in Java Last Updated : 23 Feb, 2022 Comments Improve Suggest changes 12 Likes Like Report Modulo or Remainder Operator returns the remainder of the two numbers after division. If you are provided with two numbers, say A and B, A is the dividend and B is the divisor, A mod B is there a remainder of the division of A and B. Modulo operator is an arithmetical operator which is denoted by %. NOTE: If numerator is less than denominator then % will give output as the numerator only. Syntax: A % B Where A is the dividend and B is divisorExample: Input : a = 15, b = 6 // 15%6 means when we divide 15(numerator) by 6(denominator) we get remainder 3// Output: 3Input : a = 16, b = 4 Output: 0 Approach: Take Dividend and Divisor from the user.Create an integer variable and assign it with A % B expression.Print that variable.Below is the implementation of the above approach: Java // Implementation of Modulo or Remainder Operator in Java import java.io.*; import java.util.*; class GFG { public static void main(String[] args) { // Dividend int a = 15; // Divisor int b = 8; // Mod int k = a % b; System.out.println(k); } } Output7 Time Complexity : Modular function usually takes Constant time / O(1) time like other arithmetic operations. Create Quiz Comment T tejswini2000k Follow 12 Improve T tejswini2000k Follow 12 Improve Article Tags : Java Java Programs Java-Operators Explore Java BasicsIntroduction to Java3 min readJava Programming Basics9 min readJava Methods6 min readAccess Modifiers in Java4 min readArrays in Java7 min readJava Strings7 min readRegular Expressions in Java3 min readOOP & InterfacesClasses and Objects in Java5 min readAccess Modifiers in Java4 min readJava Constructors4 min readJava OOP(Object Oriented Programming) Concepts10 min readJava Packages2 min readJava Interface7 min readCollectionsCollections in Java12 min readCollections Class in Java13 min readCollection Interface in Java4 min readIterator in Java4 min readJava Comparator Interface5 min readException HandlingJava Exception Handling6 min readJava Try Catch Block4 min readJava final, finally and finalize4 min readChained Exceptions in Java3 min readNull Pointer Exception in Java5 min readException Handling with Method Overriding in Java4 min readJava AdvancedJava Multithreading Tutorial3 min readSynchronization in Java7 min readFile Handling in Java4 min readJava Method References9 min readJava 8 Stream Tutorial7 min readJava Networking6 min readJDBC Tutorial5 min readJava Memory Management3 min readGarbage Collection in Java6 min readMemory Leaks in Java3 min readPractice JavaJava Interview Questions and Answers15+ min readJava Programs - Java Programming Examples7 min readJava Exercises - Basic to Advanced Java Practice Programs with Solutions5 min readJava Quiz1 min readJava Project Ideas For Beginners and Advanced15+ min read Like