Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created October 8, 2013 22:53
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/6893182 to your computer and use it in GitHub Desktop.
Save Fhernd/6893182 to your computer and use it in GitHub Desktop.
Demostración de la sintaxis de captura de los argumentos pasados desde la línea de comandos en C#.
using System;
public class Calculadora
{
public static void Main (string[] args)
{
int a = Convert.ToInt32( args[0] );
int b = Convert.ToInt32( args[1] );
// Realiza operaciones aritméticas básicas
Console.WriteLine ("La adición de {0} y {1} es {2}.", a, b, (a+b));
Console.WriteLine ("La sustracción de {0} y {1} es {2}.", a, b, (a-b));
Console.WriteLine ("El producto de {0} y {1} es {2}.", a, b, (a*b));
Console.WriteLine ("El cociente de {0} y {1} es {2}.", a, b, (a/b));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment