Find all Pairs possible from the given Array | Function to print all possible pairs from the array ; Nested loop for all possible pairs ; Driver code
function printPairs ( arr , n ) { for ( var i = 0 ; i < n ; i ++ ) { for ( var j = 0 ; j < n ; j ++ ) { document . write ( " " + arr [ i ] + " " + arr [ j ] + " " + " " ) ; } } } var arr = [ 1 , 2 ] ; var n = arr . length ; printPairs ( arr , n ) ;