Derste yaptığımız örnek kodlar aşağıdadır :
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _05Aralik2016KontrolDeyimleri_1 { class Program { static void Main(string[] args) { /* int not1, not2, not3, ortalama; Console.Write("1.Sınavın puanı :"); not1 = Convert.ToInt32( Console.ReadLine() ); Console.Write("2.Sınavın puanı :"); not2 = Convert.ToInt32(Console.ReadLine()); Console.Write("3.Sınavın puanı :"); not3 = Convert.ToInt32(Console.ReadLine()); ortalama = (not1+not2+not3) / 3; Console.WriteLine("Ortalamanız :{0}",ortalama); if (ortalama >= 50) // Eğer tek bir satır var ise; süslü parantez kullanılmaz { Console.WriteLine("Bravo, bu dersi geçtiniz."); Console.WriteLine("Aferin sana öğrenci."); } else Console.WriteLine("Malesef, bu derste başarısız oldunuz."); */ /* int yas; string isim; Console.Write("Adınızı giriniz :"); isim = Console.ReadLine(); Console.Write("Yaşınızı giriniz :"); yas = Convert.ToInt32( Console.ReadLine() ); if (yas >= 18) { Console.WriteLine("Sn. {0},\nEhliyet alabilirsiniz", isim); } else { Console.WriteLine("Sn. {0},\nEhliyet almak için en az 18 yaş gerekli.",isim); } */ /* int not1, not2, not3, ortalama; Console.Write("1.Sınavın puanı :"); not1 = Convert.ToInt32(Console.ReadLine()); Console.Write("2.Sınavın puanı :"); not2 = Convert.ToInt32(Console.ReadLine()); Console.Write("3.Sınavın puanı :"); not3 = Convert.ToInt32(Console.ReadLine()); ortalama = (not1 + not2 + not3) / 3; Console.WriteLine("\nOrtalamanız :{0}\n", ortalama); if (ortalama >= 0 && ortalama <= 24) Console.WriteLine("Notunuz : 0"); else if(ortalama>=25 && ortalama<=44) Console.WriteLine("Notunuz : 1"); else if (ortalama >= 45 && ortalama <= 54) Console.WriteLine("Notunuz : 2"); else if (ortalama >= 55 && ortalama <= 69) Console.WriteLine("Notunuz : 3"); else if (ortalama >= 70 && ortalama <= 84) Console.WriteLine("Notunuz : 4"); else if (ortalama >= 85 && ortalama <= 100) Console.WriteLine("Notunuz : 5"); else Console.WriteLine("Hatalı not girişi yapılmış."); */ Console.ReadLine(); } } }