Find if a number is divisible by every number in a list | C # program which check is a number divided with every element in list or no ; Function which check is a number divided with every element in list or not ; driver program
using System ; class GFG { static bool findNoIsDivisibleOrNot ( int [ ] a , int n ) { for ( int i = 0 ; i < a . Length ; i ++ ) { if ( a [ i ] % n != 0 ) return false ; } return true ; } public static void Main ( ) { int [ ] a = { 14 , 12 , 4 , 18 } ; int n = 2 ; if ( findNoIsDivisibleOrNot ( a , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }