using System; using System.Collections.Generic; using System.Text; namespace findLowAndHigh { class Program { static void Main(string[] args) { Random genRand = new Random(); int low = 101, hi = 0, newNum = 0; int i = 0; int count = 0; Console.WriteLine("This program will generate 10 random numbers between 1 and 100"); Console.WriteLine(" It will then display the highest and lowest values in the list"); Console.WriteLine(); // can you make the program count as well? // 1 42 // 2 12 // 3 78 etc. /* the for( ; ; ) loop header specifies * initialization check for limit increment * * in one set of parameters. */ for (count = 0; count < 10; count++) //while( count < 10) { newNum = genRand.Next(1, 101); Console.WriteLine("{0}\t{1}",count+1,newNum); if (newNum > hi) { hi = newNum; } if (newNum < low) { low = newNum; } //count++; } Console.WriteLine("\nHighest number was {0} and Lowest number was {1}", hi,low); Console.ReadLine(); } } }