Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Second minor int
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { var x = new []{6, 3, 4, 1, 2, 5}; int min1 = int.MaxValue, min2 = int.MaxValue; for(var i = 0; i < x.Count(); i++) { if(x[i] < min1){ if(min1 < min2) min2 = min1; min1 = x[i]; } else if(x[i] < min2) { if(min2 < min1) min1 = min2; min2 = x[i]; } } Console.WriteLine(min1 + ", " + min2); min1 = int.MaxValue; min2 = int.MaxValue; for(var i = 0; i < x.Count(); i++) { if(x[i] < min1 || x[i] < min2){ if(min1 < min2) min2 = x[i]; else min1 = x[i]; } } Console.WriteLine(min1 + ", " + min2); } } }
run
|
edit
|
history
|
help
0
ss
test2
Towers of Hanoi
int-float C# division
gg
test_hash
DAY !
Find Highest,Lowest and average using two dimensional arrays
String to keycode and switch check
newMultDiv