See More

// Program to return given array into ascending order and dsceding order import java.util.Scanner; public class SortedArray { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println(" Enter the size of the array:"); int n=scanner.nextInt(); int a[]=new int[n]; System.out.println(" Enter the elements of the array:"); for(int i=0; ia[j]) { temp=a[i]; a[i]=a[j]; a[j]=temp; } } } return a; } public static int[] descendingOrderArray(int a[]) { int temp; for(int i=0; i