Check if a number is divisible by 47 or not | C # program to check whether a number is divisible by 47 or not ; Function to check if the number is divisible by 47 or not ; While there are at least two digits ; Extracting the last ; Truncating the number ; Subtracting fourteen times the last digit to the remaining number ; Finally return if the two - digit number is divisible by 47 or not ; Driver Code
using System ; class GFG { static bool isDivisible ( int n ) { int d ; while ( n / 100 > 0 ) { d = n % 10 ; n /= 10 ; n = Math . Abs ( n - ( d * 14 ) ) ; } return ( n % 47 == 0 ) ; } public static void Main ( ) { int N = 59173 ; if ( isDivisible ( N ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }