Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/76f0a8f0cf4298fc5de9 to your computer and use it in GitHub Desktop.
Save Fhernd/76f0a8f0cf4298fc5de9 to your computer and use it in GitHub Desktop.
Prueba de Enlace de Lenguaje en C#.
// 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)
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment