% operator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

% operator

An example of % operator please

4th Sep 2019, 5:01 PM
Phantom
Phantom - avatar
5 Answers
+ 2
3 % 2 = 1 6 % 4 = 2 16 % 8 = 0 % operator gives the remainder.
4th Sep 2019, 5:09 PM
Tashila Pathum
Tashila Pathum - avatar
+ 2
% is mod operator for remain results of divide (10%2)=0 and (11%2)=1
4th Sep 2019, 5:11 PM
Vahid
Vahid - avatar
+ 2
% is basically the modulus operator which returns the remainder. For example: 5%2=1
4th Sep 2019, 5:24 PM
Chetali Shah
Chetali Shah - avatar
0
Thx a lot.
4th Sep 2019, 5:24 PM
Phantom
Phantom - avatar