Find ' N ' number of solutions with the given inequality equations | Function to calculate all the solutions ; there is no solutions ; print first element as y - n + 1 ; print rest n - 1 elements as 1 ; initialize the number of elements and the value of x an y
< ? php function findsolution ( $ n , $ x , $ y ) { if ( ( $ y - $ n + 1 ) * ( $ y - $ n + 1 ) + $ n - 1 < $ x $ y < $ n ) { echo " No ▁ solution " ; return ; } echo $ y - $ n + 1 ; while ( $ n -- > 1 ) echo " STRNEWLINE " . 1 ; } $ n = 5 ; $ x = 15 ; $ y = 15 ; findsolution ( $ n , $ x , $ y ) ;