0

C# y%x = ?

In C# there is this thing % and I don't understand what it does?? Maybr someone knows how it works? For excample 5*4

5th Mar 2020, 9:05 PM
LmaoPewPew
LmaoPewPew - avatar
9 Answers
+ 1
Since 2*2=4, So we divide 4 by 2 quotient we get is 2, reminder is 0 That is 4/2=2, 4%2=0 And 5 divided by 2,then quetiont is 2, reminder is 1, Since 2*2=4, (5-4=1) so reminder is 1 Similarly 12/3=4 since 3*4=12, reminder 0,so 12%3=0 20/3=6 since 3*6=18, reminder 20-18=2,so 20%3=2... Hope this clears you.. Is it?
5th Mar 2020, 9:31 PM
Jayakrishna šŸ‡®šŸ‡³
+ 1
It gives reminder Ex: 5%2=1
5th Mar 2020, 9:07 PM
Jayakrishna šŸ‡®šŸ‡³
+ 1
But why is so?
5th Mar 2020, 9:07 PM
LmaoPewPew
LmaoPewPew - avatar
+ 1
I don't understand what do you mean and about your doubt? Can you give some more clarity... It's a basic arithmatic operation... To find about reminder we need %, To find quetiont we use /.
5th Mar 2020, 9:22 PM
Jayakrishna šŸ‡®šŸ‡³
+ 1
But idk how to calculate the reminder Also don't know what the reminder is
5th Mar 2020, 9:23 PM
LmaoPewPew
LmaoPewPew - avatar
+ 1
OK thanks
5th Mar 2020, 9:34 PM
LmaoPewPew
LmaoPewPew - avatar
+ 1
You're Wel come..
5th Mar 2020, 9:35 PM
Jayakrishna šŸ‡®šŸ‡³
0
It's called a modulus and give the remainder of division. 8%3=2 3 goes into 8 twice to a total of 6. Leaving 2 remaining. Eg. You have 8 candies, you have 3 friends and you want to give the candies away evenly but need to know how many you have remaining. So you give each friend 2 candies from a total of 6 which leave 2 left. Now you can do something with the remaining 2.
7th Mar 2020, 1:34 AM
Rabinski
Rabinski - avatar