Whats the utility of the modulo operation. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Whats the utility of the modulo operation.

I took a long time for my stupid self to get it, and now I don't get the point. How is this useful?

6th Dec 2017, 2:18 PM
Matteo Campanella
Matteo Campanella - avatar
2 Answers
+ 1
It's how you find the remainder from division and return it as an integer number. You know, 11 divided by 5 equals 2 with a remainder of 1. Of course, you could always use a float/double and get a result of 2.5 instead, if that's what you're wanting.
6th Dec 2017, 2:50 PM
AgentSmith
+ 1
It's useful, for programs involving math, fields, GUI geometry, algorithm: euclidean( GCD), i can think of another use for a game. In python, you not only get the remainder, but the whole number as well which can serve a purpose. Modulo is like rock climbing and you're rappeling down
6th Dec 2017, 3:05 PM
Echo One
Echo One - avatar