CKTIS / C#
%: practical reference
%: practical reference: % returns the remainder after division; for signed values its sign follows the left operand.
Version: C# operator reference; verified against C# 14
Syntax
left % right% returns the remainder after division; for signed values its sign follows the left operand.
Use it for cycles and divisibility tests after deciding how negatives should behave.
It is not mathematical modulo for negative values.
A zero divisor throws for integer or decimal, while floating point returns NaN.
The complete program actually uses %; its exact expected stdout is 2.
Examples
using System;
using System.Linq;
using System.Threading.Tasks;
Console.WriteLine(17 % 5);
Result
2
The complete program actually uses `%`; its exact expected stdout is `2`.