What does the '%' operator mean?

后端 未结 11 1764
执笔经年
执笔经年 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:57

    It is modulus operator

    using System;
    class Test
    {
        static void Main()
        {
    
            int a = 2;
            int b = 6;
    
            int c = 12;
            int d = 5;
    
            Console.WriteLine(b % a);
            Console.WriteLine(c % d);
            Console.Read();
        }
    }
    

    Output:

    0
    2
    

提交回复
热议问题