New course! Every coder should learn Generative AI!
Try a free lesson0
If you meant ascending order...read on otherwise plz elaborate.
int a[]=new int[3];//creating an array
a[0]=x;
a[1]=y;
a[2]=z;//x y and z are user input
int j, k;
for (j=0; j <3; j++){
for (k=0; k <(3-1-i); k++){
if (a[j]> a [j+1])
{
int r=a [j];
a[j]=a[j+1];
a[j+1]=r;
}
}
}
for(j=0;j<3;j++){
System.out.println (a[j]);}