Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion Digits Sort Dummy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,30 @@ private static void Main(string[] args)
int inputValue = ReadInt();
Console.WriteLine("You entered {0}", inputValue);

// TODO: implement your program
List<int> list = new List<int>();

// checking all char to one the list
foreach (char c in inputValue.ToString())
{
int digit = int.Parse(c.ToString());
// check if digit is not 0 or 5
if (digit != 0 && digit != 5)
{
list.Add(int.Parse(c.ToString()));
}
}


// debug output for al chars
//list.ForEach(x => Console.WriteLine(x));

// this sorts the list to to numbers
list.Sort();


// now print all the numbers
Console.WriteLine("The sorted Number of '{0}' is:", inputValue);
list.ForEach(x => Console.Write(x));
}

static int ReadInt()
Expand Down