Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
I know it's a bit combersome, but it's my first attempt.
//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) { string[] names = new string[] {"Professor X", "Iceman", "Angel", "Beast", "Phoenix", "Cyclops", "Wolverine", "Nightcrawler", "Storm", "Colossus"}; int[] numbers = new int[] { 7,9,12,15,17,13,2,6,8,13}; string result = ""; // putting in ASP.NET web form string mostwins = ""; string leastwins = ""; int highest = 0; int lowest = 1000; int indexofhigh = 0; int indexoflow = 0; int temphigh = 1; int templow ; for(int index = 0; index < numbers.Length; index++) { //Console.WriteLine("{0} with {1} wins ",names[index],numbers[index]); temphigh = numbers[index]; templow = numbers[index]; if(numbers[index] > highest) { highest = numbers[index]; indexofhigh = index; mostwins = names[index]; } if(numbers[index] < lowest) { lowest = numbers[index]; indexoflow = index; leastwins = names[index]; } } Console.WriteLine("{0} Battles won = {1} ",mostwins,highest); Console.WriteLine("{0} Battles won = {1} ",leastwins,lowest); } } }
run
|
edit
|
history
|
help
0
C# Calculator Simple
Anq Calc
length
random number generator
little problem
Factorial using Recursion
2
Lambda Expression
sdfghnjmkuyhtgrfed
SKR2