C# �rnekleri � Girilen �fadeyi Kar��t�rmak
Kullan�c�n�n girmi� oldu�u ifadedeki harflerin yerini de�i�tirerek yeni bir ifade elde edip sonucu ekranda yazd�r�yoruz.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Console.WriteLine( "Bir ifade girin" ); string ad = Console.ReadLine(); string yeni= "" ; Random r = new Random(); int randomIndex = 0; int uzunluk=ad.Length; for ( int i = uzunluk; i > 0; i--) randomIndex = r.Next(0, uzunluk); yeni += ad[randomIndex]; ad = ad.Remove(randomIndex, 1); uzunluk=ad.Length; } Console.WriteLine(yeni); Console.ReadKey(); |
Yorum Gönder