Smallest and Largest sum of two n | Function to return the smallest sum of 2 n - digit numbers ; Function to return the largest sum of 2 n - digit numbers ; Driver code
< ? php function smallestSum ( $ n ) { if ( $ n == 1 ) return 0 ; return ( 2 * pow ( 10 , $ n - 1 ) ) ; } function largestSum ( $ n ) { return 2 * ( pow ( 10 , $ n ) - 1 ) ; } $ n = 4 ; echo " Largest = " ▁ . ▁ largestSum ( $ n ) ▁ . ▁ " " ; STRNEWLINE echo ▁ " Smallest = " ? >