// OrtizOL - xCSw
using System;
public class SinInterfazComun
{
public static void Main()
{
Int32 num1 = 3;
Int32 num2 = 7;
Console.WriteLine("Promedio de {0} y {1}: {2}", num1.ToString(),
num2.ToString(),
Promedio(num1, num2));
}
// Versión dinámica de cálculo de promedio de dos números:
public static dynamic Promedio(dynamic x, dynamic y)
{
return (x + y) / 2;
}
// public static Int32 Promedio(Int32 x, Int32 y)
// {
// return (x + y) / 2;
// }
// public static double Promedio(double x, double y)
// {
// return (x + y) / 2;
// }
// Otras implementaciones para los tipos integrales (o integrales)
// ...
}
Ly8gT3J0aXpPTCAtIHhDU3cKCnVzaW5nIFN5c3RlbTsKCnB1YmxpYyBjbGFzcyBTaW5JbnRlcmZhekNvbXVuCnsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKICAgIHsKICAgICAgICBJbnQzMiBudW0xID0gMzsKICAgICAgICBJbnQzMiBudW0yID0gNzsKICAgICAgICAKICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiUHJvbWVkaW8gZGUgezB9IHkgezF9OiB7Mn0iLCBudW0xLlRvU3RyaW5nKCksIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bTIuVG9TdHJpbmcoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQcm9tZWRpbyhudW0xLCBudW0yKSk7CiAgICB9CiAgICAKICAgIC8vIFZlcnNpw7NuIGRpbsOhbWljYSBkZSBjw6FsY3VsbyBkZSBwcm9tZWRpbyBkZSBkb3MgbsO6bWVyb3M6CiAgICBwdWJsaWMgc3RhdGljIGR5bmFtaWMgUHJvbWVkaW8oZHluYW1pYyB4LCBkeW5hbWljIHkpCiAgICB7CiAgICAgICAgcmV0dXJuICh4ICsgeSkgLyAyOwogICAgfQogICAgCiAgICAvLyBwdWJsaWMgc3RhdGljIEludDMyIFByb21lZGlvKEludDMyIHgsIEludDMyIHkpCiAgICAvLyB7CiAgICAgICAgLy8gcmV0dXJuICh4ICsgeSkgLyAyOwogICAgLy8gfQogICAgCiAgICAvLyBwdWJsaWMgc3RhdGljIGRvdWJsZSBQcm9tZWRpbyhkb3VibGUgeCwgZG91YmxlIHkpCiAgICAvLyB7CiAgICAgICAgLy8gcmV0dXJuICh4ICsgeSkgLyAyOwogICAgLy8gfQogICAgCiAgICAvLyBPdHJhcyBpbXBsZW1lbnRhY2lvbmVzIHBhcmEgbG9zIHRpcG9zIGludGVncmFsZXMgKG8gaW50ZWdyYWxlcykKICAgIC8vIC4uLgp9