fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5.  
  6. namespace Application
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. int[] a = new int[] { 5, 12, 13, 2, 1, 9, 15, 19, 6 };
  13. int oneMinValue = a[0];
  14. int twoMinValue = a[0];
  15.  
  16. for (int i = 0; i < a.Length; i++)
  17. {
  18. if (twoMinValue > a[i])
  19. {
  20. twoMinValue = a[i];
  21. }
  22. if (twoMinValue < oneMinValue)
  23. {
  24. int tmp = twoMinValue;
  25. twoMinValue = oneMinValue;
  26. oneMinValue = tmp;
  27. }
  28.  
  29. }
  30.  
  31. Console.WriteLine(oneMinValue);
  32. Console.WriteLine(twoMinValue);
  33. }
  34. }
  35. }
  36.  
  37.  
Success #stdin #stdout 0.03s 22540KB
stdin
Standard input is empty
stdout
1
2