1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-09-16 20:56:57 +02:00
CodeWars/7kyu/beginner_series_iii/solution.cs

15 lines
210 B
C#
Raw Permalink Normal View History

using System;
public class Sum
{
public int GetSum(int a, int b)
{
if (a > b) {
var temp = a;
a = b;
b = temp;
}
return (a + b) * (Math.Abs(b - a) + 1) / 2;
}
}