using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace kiemtra
{ class Cau20
{
public static void sapxeptangdan(int[] a, int n)
{
int i, j, temp;
Console.WriteLine("mang sap xep tang dan:");
for (i = 0; i < n; i++)
{
for (j = i + 1; j < n; j++)
{
if (a[i] > a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
}
public static void xuatmang(int[] a, int n)
{
for (int i = 0; i < n; i++)
{
Console.WriteLine(a[i]);
}
}
static void Main()
{
int n;
Console.WriteLine("nhap so phan tu cho mang:");
n = Convert.ToInt32(Console.ReadLine());
int[] a = new int[n];
for (int i = 0; i < n; i++)
{
Console.WriteLine("a[" + i + "]" + "=");
a[i] = Convert.ToInt32(Console.ReadLine());
}
sapxeptangdan(a, n);
}
}
}
moi nguoi giup em them x vao mang vs a


83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?