Minimum and maximum number of N chocolates after distribution among K students | Java implementation of the above approach ; Driver code
public class Improve { public static void main ( String args [ ] ) { int n = 7 ; int k = 3 ; if ( n % k == 0 ) System . out . println ( n / k + " ▁ " + n / k ) ; else System . out . println ( ( n - ( n % k ) ) / k + " ▁ " + ( ( ( n - ( n % k ) ) / k ) + 1 ) ) ; } }