Largest and Smallest N | Function to return the largest N - digit number in Octal Number System ; Append '7' N times ; Function to return the smallest N - digit number in Octal Number System ; Append '0' ( N - 1 ) times to 1 ; Function to print the largest and smallest N - digit Octal number ; Driver code ; Function Call
function findLargest ( N ) { var largest = new Array ( N + 1 ) . join ( ' ' ) ; return largest ; } function findSmallest ( N ) { var smallest = " " + new Array ( N ) . join ( ' ' ) ; return smallest ; } function printLargestSmallest ( N ) { document . write ( " " + findLargest ( N ) + " " ) ; document . write ( " " + findSmallest ( N ) ) ; } var N = 4 ; printLargestSmallest ( N ) ;