using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sorting1
{
class Program
{
static void Main(string[] args)
{
int[] arr = new int[5];
int a, b, temp = 0;
Console.WriteLine("Enter Number");
for (int i = 0; i < 5; i++)
{
arr[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine();
for (a = 0; a < 4; a++)
{
for (b = a+1; b < 5; b++)
{
if (arr[a] > arr[b])
{
temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
}
}
for(a = 0; a < 5; a++)
{
Console.WriteLine(arr[a]);
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment