Factorial nomli rekursiv funksiya tuzing. X sonini quyidagi formula yordamida hisoblovchi Formula


Download 53.48 Kb.
bet5/8
Sana16.06.2023
Hajmi53.48 Kb.
#1489108
1   2   3   4   5   6   7   8
Bog'liq
algoritm 29-talik topshiriq javoblari

struktura hosil qiling. U quyidagi maydonlardan iborat bo`lsin: FISh, yosh, lavozim, maosh. Maoshi 2000 000 dan ko`p bo`lgan xodimlar haqidagi ma`lumotlarni ekranga chiqaruvchi dastur tuzing.
struct Xodim
{
public string FISh;
public int yosh;
public string lavozim;
public double maosh;
}
class Program
{
static void Main(string[] args)
{
Xodim[] xodim = new Xodim[3];

xodim[0].FISh = "Ali Akbarov";


xodim[0].yosh = 28;
xodim[0].lavozim = "Menejer";
xodim[0].maosh = 3000000;

xodim[1].FISh = "Vali Mustafov";


xodim[1].yosh = 35;
xodim[1].lavozim = "Direktor";
xodim[1].yosh = 500000;

xodim[2].FISh = "Hasan Yusupov";


xodim[2].yosh = 22;
xodim[2].lavozim = "Kasbiy";
xodim[2].yosh = 250000;

Console.WriteLine("Maoshi 2,000,000 dan ko'p bo'lgan xodimlar:");


foreach (Xodim xodim1 in xodim)


{
if (xodim1.maosh > 2000000)
{
Console.WriteLine("FISh: {0}", xodim1.FISh);
Console.WriteLine("Yoshi: {0}", xodim1.yosh);
Console.WriteLine("Lavozimi: {0}", xodim1.lavozim);
Console.WriteLine("Maoshi: {0}\n", xodim1.maosh);
}
}
}
}

18-savol
Shaxs nomli struktura hosil qiling. U quyidagi maydonlardan iborat bo`lsin: FISh, yosh, bo`y_uzunligi, og`irligi. Yoshi 16 dan katta bo`lgan shaxslar haqidagi barcha ma`lumotni ekranga chiqaruvchi dastur tuzing.

struct Shaxs
{
public string FISh;
public int yosh;
public double boy;
public double ogirlik;
}

class Program


{
static void Main(string[] args)
{
Shaxs[] shaxslar = new Shaxs[4];

for (int i = 0; i < shaxslar.Length; i++)


{
Console.WriteLine($"{i + 1}-shaxsning ma'lumotlarini kiriting:");
Console.Write("FISh: ");
shaxslar[i].FISh = Console.ReadLine();
Console.Write("Yosh: ");
shaxslar[i].yosh = int.Parse(Console.ReadLine());
Console.Write("Bo'yi (metrlar): ");
shaxslar[i].boy = double.Parse(Console.ReadLine());
Console.Write("Og'irliki (kilogramm): ");
shaxslar[i].ogirlik = double.Parse(Console.ReadLine());
}

Console.WriteLine("\n16 yoshdan katta shaxslar haqida ma'lumotlar:");


foreach (Shaxs shaxs in shaxslar)


{
if (shaxs.yosh > 16)
{
Console.WriteLine($"FISh: {shaxs.FISh}, Yosh: {shaxs.yosh}, Bo'yi: {shaxs.boy} metr, Og'irlik: {shaxs.ogirlik} kg");
}
}
}
}

19-savol
O`quvchi nomli


Download 53.48 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling