using System;
class Program
{
static void printSmallest3(int[] arr) {
int first, second, third;
int len = arr.Length;
if (len < 3) {
return;
}
first = third = second = int.MaxValue;
for (int i = 0; i < len; i++) {
if (arr[i] < first) {
third = second;
second = first;
first = arr[i];
}
else if (arr[i] < second) {
third = second;
second = arr[i];
}
else if (arr[i] < third)
third = arr[i];
}
Console.WriteLine(first + " " + second + " " + third);
}
static void Main() {
int[] arr = new int[] { 12, 98, 80, 50, 88, 35, 70, 60, 97, 85, 89 };
printSmallest3(arr);
}
}
/*
run:
12 35 50
*/