tags:

views:

310

answers:

9

What does (10%2) mean?

+1  A: 

The modulus operator (%) computes the remainder after dividing its first operand by its second.

Darin Dimitrov
+16  A: 

% is the modulus operator.

So this essentially says - what is the remainder of 10 divided by 2?

10 % 2 == 0
10 % 5 == 0
10 % 7 == 3
10 % 3 == 1
Oded
tnx for your help
shujaat
+2  A: 

10 % 2 should give you 0. It is the MODULUS operator

InSane
+4  A: 

10 modulo 2, or in other words, it gives you the remainder of a division by 2

For example, 10 % 2 is 0, because there is no remainder after you divide by 2.

eg 10 % 3 -> this would divide by 3, which results in 1 remainder (10 = 3*3 + 1)

Zaki
+1  A: 

10%2 is 0, 10 divided by 2, rest is 0. This can also mean that number is even.

Webarto
A: 

% is basiacally a modulus opertor which gives you the remainder of a division operation between integers.

Here is a exhaustive list of operators in C, their names and functionlaity along with some examples and clear explanation.

Praveen S
A: 

In computing, the modulo operation finds the remainder of division of one number by another.

I've recently seen this code:

int a, b;
[...]
if (a/b == double(a)/b) ...

Haha.

(Hint: What he really wanted was if(!a%b))

niscy
Oops downvote :)Sorry, couldn't find a way to add a comment anywhere, apparently I don't have enough rep yet. Now even less so.
niscy
A: 

% is used fr finding the remainder. now % and / are two different operators. where / gives the quotient, % outputs the remainder.

10 % 2 =0

10/2 =5

hopefulLLl
A: 

10%2 means that when you divide 10 by 2 then what is the remainder.The remainder becomes the answer.

10

----------!

fahad