0% found this document useful (0 votes)
3 views1 page

Array Sorting

The document contains a C# program that sorts an array of integers. It prompts the user to enter four elements, sorts them in ascending order using a nested loop, and then displays the sorted elements. The program is structured within a console application framework.

Uploaded by

nancy_mary
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Array Sorting

The document contains a C# program that sorts an array of integers. It prompts the user to enter four elements, sorts them in ascending order using a nested loop, and then displays the sorted elements. The program is structured within a console application framework.

Uploaded by

nancy_mary
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ARRAY SORTING

using System;
using [Link];
using [Link];
using [Link];
using [Link];

namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
int[] a = new int[10];
int i,j;
for(i=0;i<4;i++)
{
[Link]("Enter Element");
a[i] = Convert.ToInt32([Link]());
}
for(i=0;i<4;i++)
{
for(j=i+1;j<4;j++)
{
if (a[i] > a[j])
{
int t = a[i];
a[i] = a[j];
a[j] = t;
}
}
}
for(i=0;i<4;i++)
{
[Link](a[i]);
}
}
}
}

You might also like