"Massivlar elementlari sonini kiriting: "
Download 128.5 Kb.
|
Mirrahimov Mirkomil
class Program { static void Main(string[] args) { int[] a; int[] b; Console.Write("Massivlar elementlari sonini kiriting: "); int n = Convert.ToInt32(Console.ReadLine()); a = new int[n]; b = new int[n]; for (int i = 0; i < n;i++ ) { Console.Write("a massivning " + (i + 1) + "-elementi: "); a[i] = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i < n; i++) { Console.Write("b massivning " + (i + 1) + "-elementi: "); b[i] = Convert.ToInt32(Console.ReadLine()); } int temp; for (int i = 0; i < n-1; i++) { for (int j = i + 1; j < n; j++) { if (a[i] > a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; } } } for (int i = 0; i < n-1; i++) { for (int j = i + 1; j < n; j++) { if (b[i] > b[j]) { temp = b[i]; b[i] = b[j]; b[j] = temp; } } } int t = 0; for (int i = 0; i < n; i++) { if (a[i] == b[i]) { continue; } else { t++; break; } } if(t!=0) Console.WriteLine("Sonlar ketmaketligi birxil emas"); else Console.WriteLine("Sonlar ketmaketligi birxil"); Console.ReadKey(); } Download 128.5 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling