1-) C# - 1'le 100 arasında rastgele 20 tane sayı üretip,int diziye atadıktan sonra consola yazma.
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 ODEV2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Soru 6- bir ile yüz arasında rastgele yirmi tane sayı tanımlayıp int dizisine atayin
// ve bu diziyi for ile ekrana yazın
private void button1_Click(object sender, EventArgs e)
{
int[] a = new int[20]; // int diziye 20 sayı atandı.
Random w = new Random(); // rastgele üretim yapıldı.
for (int i = 0; i < 20; i++) // döngü yapıldı.
{
a[i] = w.Next(1, 101); // 1'le 100 arasında rastgele üretim yapıldı.
}
for (int i = 0; i < 20; i++)// Döngü ile konsola yazıldı
{
Console.WriteLine(a[i]);//
}
}
}
}