public void Main() { int[] a = new[]; int i = 0; int n = 0; int lb = 0; int ub = 0; int length = 0; int p = 0; Console.WriteLine("Enter the Five Number:=>"); for (i = 1; i <= 5; i++) { a[i] = Console.ReadLine(); lb = a.GetLowerBound(0); ub = a.GetUpperBound(0); length = a.GetLength(0); } Console.WriteLine("LowerBound:=>" + lb); Console.WriteLine("UpperBound:=>" + ub); Console.WriteLine("Length:=>" + length); for (i = 1; i <= 5; i++) { Console.WriteLine("ARRAY:=>" + a[i]); }
Array.Resize(ref a, 11); Console.WriteLine("Enter the Five Number:=>"); for (i = 6; i <= 10; i++) { a[i] = Console.ReadLine(); lb = a.GetLowerBound(0); ub = a.GetUpperBound(0); length = a.GetLength(0); } Console.WriteLine("LowerBound:=>" + lb); Console.WriteLine("UpperBound:=>" + ub); Console.WriteLine("Length:=>" + length); for (i = 6; i <= 10; i++) { Console.WriteLine("ARRAY:=>" + a[i]); } Console.WriteLine("The Final Array After Reassigning : "); for (i = 1; i <= 10; i++) { Console.WriteLine("A(" + i + ") = " + a[i]); } Console.ReadLine(); }
|