1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-25 02:01:56 +01:00
CodeWars/7kyu/binary_addition/solution.cs

18 lines
244 B
C#
Raw Normal View History

using System;
public static class Kata
{
public static string AddBinary(int a, int b)
{
var sum = a + b;
var result = "";
while (sum > 0) {
result = $"{sum % 2}" + result;
sum /= 2;
}
return result;
}
}