Whats is the (%) in the programmation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whats is the (%) in the programmation

13th Nov 2016, 10:30 AM
Khaled
Khaled - avatar
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!")
13th Nov 2016, 10:37 AM
Keto Z
Keto Z - avatar
+ 1
Using %, you can get remainder of dividing. Example: 6 % 4 is 2.
13th Nov 2016, 10:37 AM
Adefful
+ 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/
13th Nov 2016, 1:03 PM
Gabriel Comaniciu
Gabriel Comaniciu - avatar
0
thanks programmers :)
13th Nov 2016, 10:46 AM
Khaled
Khaled - avatar