1. Xodimning oylik ish haqiga 45% mukofot puli qoshilsin. Hosil bolgan miqdordan 17% daromad soligi, 1,5% kasaba uyushmasi va 1% nafaqa soligi ushlab qolinsin. Qolga tegadigan pul miqdori chop etilsin
Download 0.74 Mb.
|
Nafisa
1. Xodimning oylik ish haqiga 45% mukofot puli qoshilsin. Hosil bolgan miqdordan 17% daromad soligi, 1,5% kasaba uyushmasi va 1% nafaqa soligi ushlab qolinsin. Qolga tegadigan pul miqdori chop etilsin. using System; public class Program{ public static void Main(){ int oylik = int.Parse(Console.ReadLine()); double ustama=0.45*oylik; double oylik2=oylik+ustama; double daromadsoliq=0.17*oylik2; double kasaba=(oylik2/100)*1.5; double pensiya=oylik2/100; double oladigan_oylik=oylik2-(daromadsoliq+kasaba+pensiya); Console.WriteLine(oladigan_oylik); Console.ReadKey(); } } 2.Tekislikdagi nuqta butun sonli koordinatalar bilan berilgan, agar nuqta koordinata oqlarida yotmasa 0, agar nuqta (0,0) bilan ustma ust tushsa 1, agar nuqta OX yoki OY oqlarida yotsa, mos ravishda 2 yoki 3 sonlari chop etilsin. using System; public class Program{ public static void Main(){ int x = int.Parse(Console.ReadLine()); int y=int.Parse(Console.ReadLine()); if(x==0&&y==0){ Console.WriteLine(1); } if(x>0&&y>0||x<0&&y>0||x<0&&y<0||x>0&&y<0){ Console.WriteLine(0); } if(x>0&&y==0||x<0&&y==0){ Console.WriteLine(2); } if(y>0&&x==0||y<0&&x==0){ Console.WriteLine(3); } Console.ReadKey(); } } 3. Natural n soni va ozaro teng bolmagan n ta butun sonlar ketma-ketligi berilgan. Bu ketma - ketlikning eng katta elementidan kichik bolgan sonlarning eng kattasi topilsin. using System; public class Program{ public static void Main(){ int n = int.Parse(Console.ReadLine()); int []a=new int [n]; int max=a[0]; for(int i=0; i } for(int i=1;i //Console.WriteLine(max); } } Array.Sort(a); for(int i=0; i Console.WriteLine(a[i]); } } Console.ReadKey(); } } 4.Uchlari va nuqtalarda bolgan tortbur-chakni yasash mumkinmi? Agar mumkin bolsa uning turi aniqlansin: romb, parallelogram, trapetsia, togriburchakli yoki ihtiyoriy tort-burchak. using System; using System.Collections.Generic; class Program { public static int N = 4; public static int getDis(KeyValuePair { return (a.Key - b.Key)*(a.Key - b.Key) + (a.Value - b.Value)*(a.Value - b.Value); } public static bool isPossibleRectangle(int[,] segments) { HashSet for (int j = 0; j < N; j++) { st.Add(new KeyValuePair st.Add(new KeyValuePair } if (st.Count != 4) return false; HashSet foreach(var it1 in st){ foreach(var it2 in st){ if(it1.Key != it2.Key && it1.Value != it2.Value){ dist.Add(getDis(it1, it2)); } } } if (dist.Count > 3) return false; int[] distance = new int[3]; int i = 0; foreach(var it in dist){ distance[i] = it; i = i + 1; } if (dist.Count == 2) return (2*distance[0] == distance[1]); return (distance[0] + distance[1] == distance[2]); } public static void Main() { int[,] segments = { {4, 2, 7, 5}, {2, 4, 4, 2}, {2, 4, 5, 7}, {5, 7, 7, 5} }; if(isPossibleRectangle(segments) == true){ Console.WriteLine("Yes"); } else{ Console.WriteLine("No"); } } } 5.Talabalar guruhini tavsivlovchi TALABA_GURUHI sinfi yaratilsin. Unda ixtiyoriy sondagi talalbalar bilan ishlash, qandaydir alomati boyocha talabani izlash (familiya, tugilgan yili yoki telefon nomeri boyicha), yangi yozuvni qoshish, ochirish va tartiblash imkoniyatlari bolsin. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication4 { class TAlABA_GURUHI { public string name { get; set; } public string fam { get; set; } public string guruh { get; set; } public string phone { get; set; } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication4 { class Program { static void Main(string[] args) { List new TAlABA_GURUHI{name="Jasur",fam="Sobirov",guruh="202-KIDT",phone="+998952319076"}, new TAlABA_GURUHI{name="Madina",fam="Qo`chqorova",guruh="202-KIDT",phone="+998972349076"}, new TAlABA_GURUHI{name="Rustam",fam="Nosirov",guruh="191-Fizika",phone="+998943891892"}, new TAlABA_GURUHI{name="Asadbek",fam="Kuranbayev",guruh="194-Fizika",phone="+998943876492"} }; foreach (var i in students) { Console.WriteLine(i.name + " " + i.fam + " " + i.guruh + " " + i.phone); } string st = Console.ReadLine(); var q = from x in students where x.guruh.Equals(st) select x.name + " " + x.fam + " " + x.guruh + " " + x.phone; int y = 0; foreach (var i in q) { Console.WriteLine(i); y++; } Console.WriteLine(y + " ta talaba topildi"); } } } Download 0.74 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling