MasterTR Posted December 17, 2010 Share Posted December 17, 2010 [b]Button1 tıklandığında 150 ile 250 arasında üretilen rastgele 10 sayıyı console ekranına yazan programı yazınız. [/b] Şu Code yardımcı olabilirmisiniz? [code] Random rnd = new Random(); int[] RasgeleDizi = new int[100]; for (i = 0; i < 11; i++) RasgeleDizi[i] = rnd.Next(150,250); Console.WriteLine((RasgeleDizi[i])); Console.ReadLine(); [/code] [u]hata alıyorum hatam nerde acaba?[/u] Link to comment Share on other sites More sharing options...
wmismail Posted December 17, 2010 Share Posted December 17, 2010 [codebox]Random rnd = new Random(); int i; int[] RasgeleDizi = new int[100]; for (i = 0; i < 11; i++) { RasgeleDizi[i] = rnd.Next(150, 250); Console.WriteLine((RasgeleDizi[i])); } Console.ReadLine();[/codebox] Buyur. Link to comment Share on other sites More sharing options...
MasterTR Posted December 17, 2010 Author Share Posted December 17, 2010 Teşekkür Ediyorum. Link to comment Share on other sites More sharing options...
MasterTR Posted December 17, 2010 Author Share Posted December 17, 2010 Peki bişey soracağım üretilen bu sayılar içerisinde En Büyük ve en küçüğü nasıl bulabilirim ? Link to comment Share on other sites More sharing options...
galetis Posted December 17, 2010 Share Posted December 17, 2010 [codebox] int buyuk = 150; int kucuk = 250; for (i = 0; i < 100; i++) { if(RasgeleDizi[i] > buyuk) { buyuk = RasgeleDizi[i]; } if(RasgeleDizi[i] < kucuk) { kucuk = RasgeleDizi[i]; } } [/codebox] Bu mantıkla olabilirmi ? Edit : Pardon 150 yazmayı unutmuşum Link to comment Share on other sites More sharing options...
Sansolye Posted December 17, 2010 Share Posted December 17, 2010 sayılar 150 ile 250 arasında olacak demiştin o yüzden int buyuk = 150; şeklinde olması daha makul ama mantık gayet güzel Link to comment Share on other sites More sharing options...
galetis Posted December 17, 2010 Share Posted December 17, 2010 Uyarın için saol Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.