static Tuple<int, int> GetDivideQuotientRemainder(int a, int b)
{
return new Tuple<int, int>((a / b), (a % b));
}
static KeyValuePair<int, int> GetDivideQuotientRemainder2(int a, int b)
{
return new KeyValuePair<int, int>((a / b), (a % b));
}
static void GetDivideQuotientRemainder3(int a, int b, out int q, out int r)
{
q = (a / b);
r = (a % b);
}
static void Main(string[] args)
{
var value = GetDivideQuotientRemainder(23, 4);
Console.WriteLine(“q = {0} r = {1}”, value.Item1, value.Item2);
var value2 = GetDivideQuotientRemainder2(23, 4);
Console.WriteLine(“q = {0} r = {1}”, value2.Key, value2.Value);
int q = 0;
int r = 0;
GetDivideQuotientRemainder3(23, 4, out q, out r);
Console.WriteLine(“q = {0} r = {1}”, q, r);
}