import java.util.Scanner;
public class baitap1
{ Scanner arrayName=new Scanner(System.in);
//**********************Khai Bao Bien**************************
int i,j,n;
int A[]=new int[100];;
int total=0;
//**********************NHap N*********************************
void nhap()
{
System.out.print("Nhap n=");
n=arrayName.nextInt();
System.out.println(n);//*******************hien thi size mang
//****************hien thi mang*******************
for(i=0;i<n;i++)
{ System.out.printf("nhap phan tu cho mang A["+i+"]=");
A[i]=arrayName.nextInt();
http://System.out.printf("=A[%d]"+A[i]);}
http://System.out.print(A[i]);}
//*******************Hien thi mANG********************************
//Void dislayMang()
//********************TInH TONG*******************************
int tinhtong(int A[],int n)
{
for(i=0;i<n;i++)
{
total=total+A[i];
}
}return (total);
//*********************HIEN THI TONG*********************
void hienthi()
{for(i=1;i<=n;i++)
System.out.printf(" tong cua mang A là total=%d\n",+total);
}
//**********************SAP XEP MANG***********************
void sapxep()
{
for(i=0;i<n;i++)
{
for(j=i+1;j<=n;j++)
{
if(A[j]<A[i])
{int tg;
tg=A[j];
A[j]=A[i];
A[i]=tg;
}
}
}
System.out.print("Mang da sap xep la:\n");
for(i=1;i<=n;i++)
System.out.printf("mang thu %d la %d:\n",i,A[i]);
}
//**************************Hien thi mang sap xep***********************
//void Hienthi_mang_sapxep()
//{System.out.print("Mang da sap xep la:\n");
// for(i=0;i<=n;i++)
http://System.out.printf("mang thu %d la %d:\n",i,A[i]);
http://System.out.println();//}
public static void main(String[] args)
{
baitap1 x=new baitap1();
x.nhap();
http://x.dislayMang();x.hienthi();
http://x.Hienthi_Tong();x.sapxep();
}
}