Arşiv
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DagitimProjesi { class Program { static void Main(string[] args) { string[] askerler = {“çağlar”,”hasan”,”huseyin”,”mehmet”,”nuri”,”ulvi”,”ilkkan” }; string[] sehirler = {“ankara”,”istanbul”,”hakkari” }; string[] esleme=new string[askerler.Length]; bool[] atananAskerler=new bool[askerler.Length]; bool[] gonderilenSehirler=new bool[sehirler.Length]; Random rnd = new Random(); string secilenSehir, secilenAsker; int secilenSehirIndeksi, secilenAskerIndeksi; for (int i = 0; i [...]
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SayisalLoto { class Program { static void Main(string[] args) { Random rnd = new Random(); int[] dizi=new int[6]; int uretilen; int bulunduguIndeks; int indeks = 0; while (indeks<dizi.Length) { uretilen=rnd.Next()%49+1; bulunduguIndeks = Array.IndexOf(dizi, uretilen); if (bulunduguIndeks == -1)//üretilen değer diziye daha önce eklenmemiş { dizi[indeks] = [...]
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Diziler5 { class Program { static void Main(string[] args) { int[] sayilar = new int[5]; //dizinin tüm elemanları negatif en küçük değerler yaptık for (int i = 0; i < sayilar.Length; i++) { sayilar[i] = int.MinValue; } int indeks = 0; int kullaniciDegeri; //kullanıcının giripte dizide [...]
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Diziler4 { class Program { static void Main(string[] args) { string girilenMetin; Console.Write(“Metin : “); girilenMetin = Console.ReadLine(); //string in karakterlerini karakter dizisine aktaralım char[] harfler = girilenMetin.ToCharArray(); //for (int i = harfler.Length-1; i >=0; i–) //{ // Console.Write(harfler[i]); //} //for (int i = 0; i [...]
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Diziler3 { class Program { static void Main(string[] args) { int[] sayilar=new int[3]; //dizinin eleman sayısını Length property si verir for (int i = 0; i < sayilar.Length; i++) { Console.Write(“{0}. sayı : “,i+1); sayilar[i] = Convert.ToInt32(Console.ReadLine()); } int toplam=0; foreach (int sayi in sayilar) { [...]
Son Yorumlar