I didn't understand modulus % please explain me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I didn't understand modulus % please explain me

please help me please explain me detailed information

5th Apr 2018, 2:09 PM
Sai Venkat
Sai Venkat - avatar
7 Answers
+ 1
Modulus operator is used to find remainder. If we divide 1.25 by .5 than, we can write: 1.25= .5*2(here .5*2=1)+.25 (here .25 is remainder, here further division approaches not followed as normal mathematical process follows, in normal mathematical process, we can write 1.25/.5 = 2.5) hence, 1.25 divided by .5, quotient is 2 and .25 isn't divided by .5 so it is remainder. above term is expressed by modulus sign (%),where % shows only remainder,not shows quotient. it is expressed by 5%2 = 1 11%4 = 3 5%3 = 2 3%5 = 3 6%5 = 1 12%7 = 5 2%2 = 0 1.25%.5 = .25
5th Apr 2018, 2:12 PM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
+ 2
i got it thanks for your help
5th Apr 2018, 2:21 PM
Sai Venkat
Sai Venkat - avatar
+ 1
5%2=1how please explain
5th Apr 2018, 2:16 PM
Sai Venkat
Sai Venkat - avatar
+ 1
@Sai Venkat, if we divide 5 by 2, then we get 2 as quotient and 1 as remainder. we can write 5 = 2*2+1 If we only show remainder,then we can write 5%2 = 1 (modulus sign % is used to show only remainder)
5th Apr 2018, 2:29 PM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
0
% operator gives you the remainder of your mathematical expressions. look at it: 2 | 5 | 2 4 remainder: 1
5th Apr 2018, 2:19 PM
Saleh Ibne Omar
Saleh Ibne Omar - avatar
0
@Sai Venkat, you are welcome
5th Apr 2018, 2:41 PM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
- 1
c#
6th Apr 2018, 8:03 PM
Leafy
Leafy - avatar