asd
unknown
csharp
3 years ago
3.7 kB
4
Indexable
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace firstConsoleApp { class Program { static void Main(string[] args) { #region operatörler //int a = 256; //byte b; //checked //{ // b = (byte)a; // unchecked // { // } //} //Console.WriteLine(b); //a+b //aritmetik operatorler + - * / % ++ -- //double a = 3, b = 2; //double c; //c = 3d % 2; //Console.WriteLine(c); //int a = 3; //int b=++a; //b=a=a+1 //Console.WriteLine("a={0} b={1}",a,b); //karşılaştırma < > <= >= == != bool //int a = 3, b = 3,c=8; //bool m = a<8; //Console.WriteLine(m); //mantıksal operatörler && || ! bool //int a = -3; //bool m = (a==2)&&((2 < a) || (a < 8)); //Console.WriteLine(m); //bool a1 = true; //bool a2 = !a1; //Console.WriteLine(a1); //bitwise & | ~ ^ //byte b = 3, c = 2; //byte a = (byte)(b ^ c); //a = (byte)~a; //Console.WriteLine(a); //is as //object a = 3; //bool m = a is int; //Console.WriteLine(a.GetType()); //object a = 12; //string str = a as string; //Console.WriteLine(str); // int str = null; //ternary ?: //int a = 3; //string durum = (a % 2 == 0) ? "çift" : "tek"; #endregion #region akış kontrolü //KARAR YAPILARI if-else switch // int a = 6; //string durum; //if (a % 2 == 0) //{ // Console.WriteLine("sayı ikinin katı"); //} //else if(a%3==0) // Console.WriteLine("sayı 3'e bölünüyor"); //else // Console.WriteLine("bilinmiyor"); //Console.Write("ülke kodu:"); //string kod = Console.ReadLine().ToUpper(); //// TR - Türkçe FR-Fransızca DE-Almanca AU-Almanca ////AZ - Türkçe //string dil=""; //if(kod=="TR") // dil="Türkçe"; //else if (kod == "FR") // dil = "Fransızca"; //else if (kod == "DE"||kod == "AU") // dil = "Almanca"; //else if (kod == "AZ") // dil = "Türkçe"; //int x = 3, b = 8, c = 0; //switch (kod) //{ // case "TR": dil = "Türkçe"; c = x + b; break; // case "FR": dil = "Fransızca"; break; // default: dil = "Belirsiz"; break; // case "DE": // case "AU": dil = "Almanca"; break; // case "AZ": goto case "TR"; //} //Console.WriteLine(dil); //DÖNGÜ YAPILAR for foreach while do-while string kelime = "merhaba"; foreach (char ch in kelime) { Console.WriteLine(ch); } foreach (var item in kelime) { Console.WriteLine(item); } #endregion } } }
Editor is loading...