1-) C# - 1-10000 arasında 1000 tane sayı üreten diziye atıyan sonra bu dizide en büyüğünü bulan kod.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ODEV3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Random w = new Random();
int[] a = new int[1000];
for (int i = 0; i < 1000; i++)
{
a[i] = w.Next(1, 10000);
Console.WriteLine(a[i]);
}
Console.WriteLine("*********");
for (int i = 0; i < 999; i++)
{
if (a[i] > a[i + 1]) // Küçüktür olursa en küçüğünü bulur.
{
a[i + 1] = a[i];
}
}
Console.WriteLine(a[999]);
}
}
}