abhishekabhiabhi0
BAN USER// hey! developer this may be not code complexcity
but i develop this simple code for all those developer who are new
j
so ,just do it
import java.util.Scanner;
class Amazon1{
public static void main(String s[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the size of array");
int a = sc.nextInt();
int b[] = new int[a];
int c[] = new int[a];
int i,j,k;
System.out.println("Enter the number to be short");
for(i=0;i<a;i++){
b[i] = sc.nextInt();
c[i] = b[i];
}
System.out.println("\n");
for(i=0;i<a;i++){
for(j=0;j<a;j++){
if(b[i]>b[j]){
k=b[i];
b[i]=b[j];
b[j]=k;
}
}
}
for(i=0;i<a;i++){
System.out.println(c[i]+"\t"+b[i]);
}
}
}
<-----output----->
input{ 22 1 33 4 55 2 8}
output
22 55
1 33
33 22
4 8
55 4
2 2
8 1
- abhishekabhiabhi0 September 11, 2016