daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 43 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {      
  7.         Console.WriteLine(Sum(1, 2, 3, 4, 5));
  8.         Console.WriteLine(SumWithoutParams(new int[] {1, 2, 3, 4, 5}));    
  9.     }
  10.    
  11.     public static int Sum(params int[] numbers)
  12.     {
  13.         var sum = 0;
  14.         foreach (var n in numbers) { sum += n; }
  15.         return sum;
  16.     }
  17.    
  18.     public static int SumWithoutParams(int[] numbers)
  19.     {
  20.         var sum = 0;
  21.         foreach (var n in numbers) { sum += n; }
  22.         return sum;
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top