int x=8,y=5; int result x%y//res is 3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

int x=8,y=5; int result x%y//res is 3

How is the result 3 why not 6 or 5 because I got 1.6

16th May 2020, 1:34 AM
Monica Ozugbo
Monica Ozugbo - avatar
2 Answers
+ 2
% (modules) this operator is basically used for finding reminder. Here when 8 is divided by 5 then 3 will be reminder so it will result in 3
16th May 2020, 1:38 AM
Ayush Kumar
Ayush Kumar - avatar
+ 2
You're right dear... it's 3..my calculator confused me
16th May 2020, 1:44 AM
Monica Ozugbo
Monica Ozugbo - avatar