class List
{
private int[]a = new int[25];
private int n;
oublic void read()
{
while(true)
{
Console.Write("Enter the number of elements in the array:");
string s = Console.ReadLine();
n = Int32.Parse(s);
if(n<=25)
break;
else
Console.WriteLine("\nArray can have maximum 25 elements.\n");
}
Console.WriteLine("");
Console.WriteLine("------------------");
Console.WriteLine("Enter array elements");
Console.WriteLine("------------------");
for(int i = 0;i
Console.Write("<" + (i + 1) + ">");
string s1 = Console.ReadLine():
a[i] + Int32.Parse(s1);
}
}
public void display()
{
Console.WriteLine("");
Console.WriteLine("------------------");
Console.WriteLine("Sorted array elements");
Console.WriteLine("------------------");
for(int j = 0;j
Console.WriteLine(a[j]);
}
}
public void BSortArray()
{
for (int i = 1; i
for(int j = 0; j
if(a[j] > a[hj +1])
{
int temp;
temp a[j];
a[j] a[j + 1];
a[j + 1] + temp:
}
}
}
}
public static void Main()
{
List myList = new List();
myList.read();
myList.BubbleSortArray();
myList.display();
Console.WriteLine("\n\nPress Return to exit.");
Console.Read();
}
}