🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Burak HABER / C# / soru 3 100 900 arasında 200 tane random sayı üretip.

1-) C# - soru 3 100 900 arasında 200 tane random sayı üretip.

 Üretilenler arasında en büyüğünü ve en küçüğünü bulup ekrana yazan programı yazınız.

not : Tek boyutlu dizi kullanılarak yapmak zorundadır.


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Globalization;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

 

namespace GENEL

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            int[] a = new int[201];

            Random w = new Random();

 

            for (int i = 0; i < 200; i++)

            {

                a[i] = w.Next(100, 900);

                

            }

            for (int i = 0; i < 200; i++)

            {

                if (a[i] > a[i + 1])// en büyüğünü bulma

                {

                    a[i + 1] = a[i];

                }

 

            }

            Console.WriteLine(a[200]);

            for (int i = 0; i < 200; i++)

            {

                if (a[i] < a[i + 1])// en küçüğünü bulma

                {

                    a[i + 1] = a[i];

                }

 

            }

            Console.WriteLine(a[200]);

 

        }

    }

}

 

 2021 Mart 11 Perşembe
 379