Factorial nomli rekursiv funksiya tuzing. X sonini quyidagi formula yordamida hisoblovchi Formula
Download 53.48 Kb.
|
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
struct Shaxs
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
Download 53.48 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling