25 lines
570 B
C#
25 lines
570 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace skyscraper8.Skyscraper
|
|
{
|
|
internal static class IntegerExtensions
|
|
{
|
|
public static int GetHighestDigit(this int source)
|
|
{
|
|
int result = 0;
|
|
while (source > 0)
|
|
{
|
|
int currentDigit = source % 10;
|
|
if (currentDigit > result)
|
|
result = currentDigit;
|
|
source /= 10;
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|