+ 1
I didn't understand modulus % please explain me
please help me please explain me detailed information
7 Réponses
+ 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
+ 2
i got it thanks for your help
+ 1
5%2=1how please explain
+ 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)
0
% operator gives you the remainder of your mathematical expressions.
look at it:
2 | 5 | 2
4
remainder: 1
0
@Sai Venkat, you are welcome
- 1
c#