C语言 (10%2) 是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3536723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:15:35  来源:igfitidea点击:

What does (10%2) mean?

coperatorsmodulomodulus

提问by shujaat

What does the code (10%2)mean?

代码(10%2)是什么意思?

回答by Oded

%is the modulusoperator.

%运算符。

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

所以这基本上是说 - 10 除以 2 的余数是多少?

10 % 2 == 0
10 % 5 == 0
10 % 7 == 3
10 % 3 == 1

回答by Zaki

10 modulo 2, or in other words, the remainder of 10 divided by 2.

10 模 2,或者换句话说,10 除以 2 的余数。

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

10 % 20因为除以 2 后没有余数。

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

10 % 3-> 这将除以 3,得到的余数为1(10 = 3*3 + 1)

回答by Jagmag

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

10 % 2 应该给你 0。它是 MODULUS 运算符

回答by Darin Dimitrov

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

取模运算符(%)计算其第一个操作数除以第二个操作数后的余数。

回答by Dejan Marjanovic

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

10%2 为 0,10 除以 2,其余为 0。这也可能意味着数字是偶数。

回答by Praveen S

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

%基本上是一个模运算符,它为您提供整数之间的除法运算的余数。

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

是 C 中运算符的详尽列表、它们的名称和功能以及一些示例和清晰的解释。

回答by Kraken

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

% 用于查找余数。现在 % 和 / 是两个不同的运算符。其中 / 给出商, % 输出余数。

10 % 2 =0

10 % 2 =0

10/2 =5

10/2 =5

回答by fuddin

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

10%2 意味着当你将 10 除以 2 时,余数是多少。余数就是答案。

10

10

----------!

----------!