30.11.21 Mavzu: Bir o’lchovli massivlar (takrorlash).
using System;
namespace Massiv
{
class Program
{
static void Main(string[] args)
{
/*
int[] a = new int[100];
string[] b = new string[100];
Console.WriteLine(a[0]);
a[0] = 11;
a[1] = 22;
a[2] = Convert.ToInt32(Console.ReadLine());
a[3] = Convert.ToInt32(Console.ReadLine());
a[4] = Convert.ToInt32(Console.ReadLine());
a[5] = Convert.ToInt32(Console.ReadLine());
for(int i=6; i<=99; i++){
a[i] = Convert.ToInt32(Console.ReadLine());
}
Random obyektim = new Random();
Console.WriteLine(obyektim.Next(100)); // 0 - 99 sonlaridan ixtiyoriy tarizda hosil qiladi
Console.WriteLine(obyektim.Next(-100, 100)); // -100 - 99
Console.WriteLine(obyektim.NextDouble());
for(int i=0;i<=99;i++){
a[i] = obyektim.Next(1000);
Console.WriteLine($"a[{i}] = " + a[i]);
}
b[0] = "Amaliy";
b[1] = "Matematika";
Console.WriteLine(b[0]);
string[] talabalar = {"Abdug'afforov N.", "Abdurahimova O.",
"Ahmadjonov M.",
"Ahadqulov S.","Davronov Sh.",
"Elboyev U.", "Eshmamatova G.",
"Ibragimov Sh.","Ismatov N.",
"Ismatullaeva Sh.", "Juraev S.",
"Jumaboev S.","Kamolova M.",
"Mamadiev F.","Mamadiyorova M.",
"Mahamatova Z.","Musaev S.",
"Norpulatov R.","Orifjonova M.",
"Qarshiev M.","Qahhorova Y.",
"Qulmatov Z.","Ruzimorodov Sh.",
"Solijonov M.","Turg'unov Z.",
"Xusanov Sh.",
"Zokirov Z.", "G'afforov J.",
"Mingboyeva H.", "Saidkarimov S."};
//int[] a = {1, 90, 78};
Random obyekt = new Random();
//Console.WriteLine(talabalar[obyekt.Next(31)]);
//Console.WriteLine(talabalar[obyekt.Next(31)]);
//Console.WriteLine(talabalar[obyekt.Next(31)]);
//Console.WriteLine(talabalar[obyekt.Next(31)]);
//Console.WriteLine(talabalar[obyekt.Next(31)]);
string[] chiqganlar = new string[5];
for(int i=0;i<5;i++){
Console.WriteLine(talabalar[obyekt.Next(31)]);
}
*/
int elementlar_soni;
elementlar_soni = Convert.ToInt16(Console.ReadLine());
int[] butun_sonlar = new int[elementlar_soni];
Random obj = new Random();
for(int i=0;i butun_sonlar[i] = obj.Next(-100, 101);
Console.WriteLine($"butun_sonlar[{i}] = " + butun_sonlar[i]);
}
}
}
}
Dostları ilə paylaş: |