What does % means pls | Sololearn: Learn to code for FREE!


What does % means pls

8/7/2022 11:03:46 PM

Adejare Oluwaseyi

3 Answers

New Answer


Greetings. In C++ the % (modulus) operator gives us the remainder of a division. Let A and B be 2 real numbers. We'll have the relationship: A/B = Q + R Where Q is the quotient and R is the remainder. When R = 0, the 2 numbers A and B are multiples.


Please tag the language you are asking about and show an example for context of how you saw it used. It depends on the language. In SQL % is a wildcard character that means to match any or no character in a string comparison. In many languages % is the modulo operator. It can be thought of as finding the remainder after calculating the quotient of a division. For example, 25%7 -> 25/7 = 3, with remainder of 4 -> so 4 is the result. Some languages use % in string formatting specifiers, like "%d" tells printf in C to format as an integer number.


If we tolk about operators %(modelus) is used to give us reminder of division. So if you divide for example 10 % 3 reminder will be 1 Because we cant divide 10 and get number without floating points, so closest smaller number we can divide by 3 is 9 9 / 3 = 3 10 - 9 = 1 - our reminder is 1 This is very useful if you need to find is number even for example. So if num % 2 == 0 (if reminder is 0 we know number can be divided by 2, so it is even)