How can I calculate divide and modulo for integers in C#?

前端 未结 5 1198
醉梦人生
醉梦人生 2020-12-01 11:28

How can I calculate division and modulo for integer numbers in C#?

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 12:13

    Division is performed using the / operator:

    result = a / b;
    

    Modulo division is done using the % operator:

    result = a % b;
    

提交回复
热议问题