using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace sorting
{
class Program
{
static void Main(string[] args)
{
int[] arr;
arr = new int[10];
int i,temp,j;
Console.WriteLine("enter the element");
for (i = 1; i < 4; i++)
{
arr[i] = Int32.Parse(Console.ReadLine()
);
}
for (i = 1; i < 4; i++)
{
for (j = 1; j < 4-i;j++ )
if (arr[j] > arr[j+1])
{
temp=arr[j+1];
arr[j+1]=arr[j];
arr[j]=temp;
}
}
for(i = 1; i < 4; i++)
Console.WriteLine("array is " + arr[i]);
}
}
}
No comments:
Post a Comment