0
Whats is the (%) in the programmation
4 Answers
+ 2
It's the modulus, or mod. It takes the remainder of two numbers. Example:
14 % 5 = 4
Because 14 goes into 5 evenly twice, and four is left over. Real world example:
if num % 2 == 0:
//if num is even
print("It is even!")
else:
print("It is odd!")
+ 1
Using %, you can get remainder of dividing.
Example: 6 % 4 is 2.
+ 1
The % symbol followed by a char can be used also in conversion type in some languages. For Python you can find here more:
https://www.tutorialspoint.com/python/python_strings.htm
For C++ more here:
http://www.cplusplus.com/reference/cstdio/printf/
0
thanks programmers :)