Advertisement
Fhernd

SinInterfazComun.cs

Jul 5th, 2015
1,106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. // OrtizOL - xCSw
  2.  
  3. using System;
  4.  
  5. public class SinInterfazComun
  6. {
  7.     public static void Main()
  8.     {
  9.         Int32 num1 = 3;
  10.         Int32 num2 = 7;
  11.        
  12.         Console.WriteLine("Promedio de {0} y {1}: {2}", num1.ToString(),
  13.                                                         num2.ToString(),
  14.                                                         Promedio(num1, num2));
  15.     }
  16.    
  17.     // Versión dinámica de cálculo de promedio de dos números:
  18.     public static dynamic Promedio(dynamic x, dynamic y)
  19.     {
  20.         return (x + y) / 2;
  21.     }
  22.    
  23.     // public static Int32 Promedio(Int32 x, Int32 y)
  24.     // {
  25.         // return (x + y) / 2;
  26.     // }
  27.    
  28.     // public static double Promedio(double x, double y)
  29.     // {
  30.         // return (x + y) / 2;
  31.     // }
  32.    
  33.     // Otras implementaciones para los tipos integrales (o integrales)
  34.     // ...
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement