Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class accending{
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int[] A = new int[3];
- for(int i=0;i<2;i++)
- {
- A[i]= sc.nextInt();
- }
- Arrays.sort(A);
- System.out.print("Numbers in Ascending Order:" );
- for(int i = 0; i < 3; i++){
- System.out.print( " " + A[i]);
- }
- System.out.print("Numbers in Descending Order: " );
- for(int i = A.length - 1; i >= 0; i--){
- System.out.print( " " + A[i]);
- }
- }
- }
Add Comment
Please, Sign In to add comment