1. Anasayfa
  2. Nesne Tabanlı Programlama

C# Console Örnekleri – Kum Saati Prrogramı

C# Console Örnekleri – Kum Saati Prrogramı
0

Kullanıcının girmiş olduğu sayıya göre kum saati oluşturan console uygulaması
kumsaati

 Console.WriteLine("Kaç Yıldızla Kum Saati Oluşturulacak");
            int n = int.Parse(Console.ReadLine());

            Console.WriteLine("{0}",
                new string(('*'), n));

            for (int i = 0; i < n / 2 - 1; i++)
            {
                Console.WriteLine("{0}{1}{0}",
                    new string(('.'), i + 1),
                    new string(('*'), n - 2 - 2 * i));
            }//http://www.bilisimogretmeni.com/
            Console.WriteLine("{0}*{0}",
                new string(('.'), n / 2));

            for (int i = 0; i < n / 2 - 1; i++)
            {
                Console.WriteLine("{0}{1}{0}",
                    new string(('.'), n / 2 - 1 - i),
                    new string(('*'), 3 + i * 2));
            }
            //http://www.bilisimogretmeni.com/
            Console.WriteLine("{0}",
                new string(('*'), n));
            Console.ReadKey();
Bu İçeriğe Tepkin Ne Oldu?
  • 0
    ba_ar_l_
    Başarılı
  • 0
    gayet_yi
    Gayet İyi
  • 0
    te_ekk_rler
    Teşekkürler
  • 0
    anlamad_m
    Anlamadım
  • 0
    yetersiz
    Yetersiz
İlginizi Çekebilir
Subscribe
Bildir
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Yorum
Inline Feedbacks
View all comments