upto n - ( x % n ) the values will be x / n after that the values will be x / n + 1
let zp = n - ( x % n ) ; let pp = Math . floor ( x / n ) ; for ( let i = 0 ; i < n ; i ++ ) { if ( i >= zp ) document . write ( ( pp + 1 ) + " " ) ; else document . write ( pp + " " ) ; } } }