Created
October 8, 2013 22:53
-
-
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#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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