Refactorable number | C # program to check whether number is refactorable or not ; Function to count all divisors ; Initialize result ; If divisors are equal , count only one . ; Otherwise count both ; Driver code
using System ; class GFG { static bool isRefactorableNumber ( int n ) { int divCount = 0 ; for ( int i = 1 ; i <= Math . Sqrt ( n ) ; ++ i ) { if ( n % i == 0 ) { if ( n / i == i ) ++ divCount ; else divCount += 2 ; } } return n % divCount == 0 ; } public static void Main ( ) { int n = 8 ; if ( isRefactorableNumber ( n ) ) Console . WriteLine ( " yes " ) ; else Console . Write ( " no " ) ; n = 14 ; if ( isRefactorableNumber ( n ) ) Console . Write ( " yes " ) ; else Console . Write ( " no " ) ; } }