Java Program Question - MNC - Technical Interview
Here we are going to see a very Interesting and Complicated Java Programming Questions, which is asking in literally all MNC's Technical Interview's Input : Array -- { 5,1,8,-5,-1,6,2,-2,45,-55,-9,-89,9 } Output : Array -- { -89 -55 -9 9 -5 5 -2 2 -1 1 6 8 45 } Program : package com.array; public class SortingArray { public static void main ( String [] args ) { int [] arr = { 5 , 1 , 8 ,- 5 ,- 1 , 6 , 2 ,- 2 , 45 ,- 55 ,- 9 ,- 89 , 9 }; for ( int a : arr ) { System . out . print ( a + " " ); } System . out . println (); for ( int i = 0 ; i < arr . length ; i ++) { for ( int j = i ; j < arr . length ; j ++) { if ( arr [ i ]> arr [ j ]) { int temp = arr [ i ]; arr [ i ] = arr [ j ]; arr [ j ] = temp ; } } } for ( int i = 0 ; i < arr . length ; i ++) { ...