1-) C# - random for ve if kullanımı ile ORNEK
10 4000 arasında 6 tane sayı üret rastgele
sıfırınc ıı satıra tek olanları birinci satıra çift olanları yaz
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)
{
Random rnd = new Random();
int[,] dizi2 = new int[2, 3];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
int a = rnd.Next(10, 401);
int b = a % 2;
if (b == 0)//çiftir
{
if (i == 1)//0.satır
{
dizi2[1, j] = a;
}
}
else//tektir
{
if (i == 0)//0.satır
{
dizi2[0, j] = a;
}
}
}
}
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
Console.WriteLine(i + ". satır " + j + ".sütun " + dizi2[i, j]);
}
}
}
}
}