All possible values of floor ( N / K ) for all values of K | Java program for the above approach ; Function to print all possible values of Math . floor ( N / K ) ; loop from 1 to N + 1 ; Driver code
import java . util . * ; class GFG { static void allQuotients ( int N ) { HashSet < Integer > s = new HashSet < Integer > ( ) ; for ( int k = 1 ; k <= N + 1 ; k ++ ) { s . add ( N / k ) ; } for ( int it : s ) System . out . print ( it + " ▁ " ) ; } public static void main ( String [ ] args ) { int N = 5 ; allQuotients ( N ) ; } }