What does the '%' operator mean?

后端 未结 11 1742
执笔经年
执笔经年 2020-12-11 18:28

I have next code

int a,b,c;
b=1;
c=36;
a=b%c;

What does \"%\" operator mean?

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 18:41

    It's the modulus operator. That is, 2 % 2 == 0, 4 % 4 % 2 == 0 (2, 4 are divisible by 2 with 0 remainder), 5 % 2 == 1 (2 goes into 5 with 1 as remainder.)

提交回复
热议问题