13. Sorunun Cevabı

13. Klavyeden girilecek N sayısı kadar nottan en büyük ve en küçük olanı bulan programı yapınız. (Tüm soruları görmek için tıklayınız.)

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace enbuyuknot
{
    class Program
    {
        static void Main(string[] args)
        {//13. Klavyeden girilecek N sayısı kadar nottan en büyük ve en küçük olanı bulan programı yapınız. http://2gx.org
 
            Console.WriteLine("Klavyeden girilecek N sayısı kadar nottan en büyük ve en küçük olanı bulan programı yapınız. http://2gx.org");
            Console.Write("Not Sayısını Girin");
            int adet = Int32.Parse(Console.ReadLine());
            int enbuyuk = 0, enkucuk = 100;
            for (int i = 0; i < adet; i++)
            {
                Console.Write(i + 1 + ". notu giriniz: ");
                int not = Convert.ToInt32(Console.ReadLine());
                if (not > 100 || not < 0)
                {
                    Console.Write("Yanlış not girdiniz. Lütfen tekrar ");
                    i--;
                    continue;
                }
                if (not > enbuyuk)
                    enbuyuk = not;
                if (not < enkucuk)
                    enkucuk = not;
            }
            Console.WriteLine("En büyük: " + enbuyuk);
            Console.WriteLine("En küçük:: " + enkucuk);
            Console.ReadKey();
        }
    }
}

May 13th, 2010 | Kategoriler Ders, Yazılım | Toplam Okunma=2.772
İlk yorumu siz yazın.

Yorum Yazın

XHTML: İzin verilen HTML kodları: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>