Advertisement
Fhernd

Suma.cs

Nov 13th, 2017
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2.  
  3. public class Suma
  4. {
  5.     public static void Main ()
  6.     {
  7.         // Presenta todos los argumentos capturados, e incluido,
  8.         // el nombre del archivo de la aplicación.
  9.         Console.WriteLine (Environment.CommandLine);
  10.        
  11.         // acumulador de la suma de los números pasados como argumentos
  12.         double suma = 0.0;
  13.        
  14.         foreach (string s Environment.GetCommandLineArgs())
  15.         {
  16.             suma += Convert.ToDouble (s);
  17.         }
  18.        
  19.         Console.WriteLine ("La suma es {0}.", suma);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement