using System.Collections.Generic;
Console.Write("\nProgram for Ascending order of Numeric Values using BUBBLE SORT");
Console.Write("\n\nEnter the total number of elements: ");
int max = Convert.ToInt32(Console.ReadLine());
int [] numarray = new int[max];
for(int i = 0; i < max; i++)
Console.Write("\nEnter [" + (i + 1).ToString() + "] element: ");
numarray[i] = Convert.ToInt32(Console.ReadLine());
Console.Write("Before Sorting : ");
for(int k = 0; k < max; k++)
Console.Write(numarray[k] + " ");
for(int i = 1; i < max; i++)
for(int j = 0; j < max - i; j++)
if(numarray[j] > numarray[j + 1])
numarray[j] = numarray[j + 1];
Console.Write("After iteration " + i.ToString() + ": ");
for(int k = 0; k < max; k++)
Console.Write(numarray[k] + " ");
Console.Write("/*** " + (i + 1).ToString() + " biggest number(s) is(are) pushed to the end of the array ***/\n");
Console.Write("\n\nThe numbers in ascending orders are given below:\n\n");
for(int i = 0; i < max; i++)
Console.Write("Sorted [" + (i + 1).ToString() + "] element: ");
Console.Write(numarray[i]);
public static void Main()