sumallmybitches

This commit is contained in:
Alex Thomassen 2018-12-06 14:54:13 +01:00
parent 710137e092
commit 1b01ebe03f

View File

@ -20,10 +20,32 @@ namespace ClassDemo1
int sum = SumMyBitchUp(420, 69);
Write($"Sum: {sum}");
int nyVerdi = SumMyBitchUp(sum, 45678);
Write($"Ny verdi: {nyVerdi}");
int allMyBitches = SumAllMyBitchesUp(tall);
int allMyBitchesV2 = SumAllMyBitchesUpV2(tall);
Write($"DÆTTA ER ALLI SOMMA LAGT SAMMEN, TO FORSKJELLIGE GANGER: {allMyBitches} & {allMyBitchesV2}");
Console.ReadLine();
}
static int SumAllMyBitchesUp(int[] bitches)
{
return bitches.Sum();
}
static int SumAllMyBitchesUpV2(int[] bitches)
{
int sum = 0;
foreach (var tall in bitches)
{
sum = SumMyBitchUp(sum, tall);
}
return sum;
}
static int SumMyBitchUp(int first, int second)
{
return first + second;