Find the number of cells in the table contains X | Java program to find number of cells in the table contains X ; Function to find number of cells in the table contains X ; Driver code ; Function call
class GFG { public static int Cells ( int n , int x ) { int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( x % i == 0 && x / i <= n ) ans ++ ; return ans ; } public static void main ( String [ ] args ) { int n = 6 , x = 12 ; System . out . println ( Cells ( n , x ) ) ; } }