dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int GCD ( int num1 , int num2 ) { int Remainder ; while ( num2 != 0 ) { Remainder = num1 % num2 ; num1 = num2 ; num2 = Remainder ; } return num1 ; } static int FindLCM ( int a , int b ) { return ( a * b ) / GCD ( a , b ) ; } static int rangeDivisor ( int m , int n , int a , int b ) { int lcm = FindLCM ( a , b ) ; int a_divisor = n / a - ( m - 1 ) / a ; int b_divisor = n / b - ( m - 1 ) / b ; int common_divisor = n / lcm - ( m - 1 ) / lcm ; int ans = a_divisor + b_divisor - common_divisor ; return ans ; } public static void Main ( ) { int m = 3 , n = 11 , a = 2 , b = 3 ; Console . WriteLine ( rangeDivisor ( m , n , a , b ) ) ; m = 11 ; n = 1000000 ; a = 6 ; b = 35 ; Console . WriteLine ( rangeDivisor ( m , n , a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void printUnique ( int l , int r ) { for ( int i = l ; i <= r ; i ++ ) { int num = i ; bool [ ] visited = new bool [ 10 ] ; while ( num != 0 ) { if ( visited [ num % 10 ] ) break ; visited [ num % 10 ] = true ; num = num / 10 ; } if ( num == 0 ) Console . Write ( i + " ▁ " ) ; } } public static void Main ( ) { int l = 1 , r = 20 ; printUnique ( l , r ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMinZero ( int p ) { int first = 1 , second = 1 ; int number = 2 , next = 1 ; while ( next > 0 ) { next = ( first + second ) % p ; first = second ; second = next ; number ++ ; } return number ; } public static void Main ( ) { int p = 7 ; Console . WriteLine ( " Minimal ▁ zero ▁ " + " is ▁ : " + findMinZero ( p ) ) ; } }

Accumulator variables: number
Class/struct names: GFG
C# program:
using System ; class GFG { static void printCubes ( int a , int b ) { for ( int i = a ; i <= b ; i ++ ) { for ( int j = 1 ; j * j * j <= i ; j ++ ) { if ( j * j * j == i ) { Console . Write ( j * j * j + " ▁ " ) ; break ; } } } } public static void Main ( ) { int a = 1 , b = 100 ; Console . WriteLine ( " Perfect ▁ cubes ▁ in " + " ▁ given ▁ range : " ) ; printCubes ( a , b ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class BinaryToString { static string printBinary ( double num ) { if ( num >= 1 num <= 0 ) return " ERROR " ; string binary = " " ; double frac = 0.5 ; binary += " . " ; while ( num > 0 ) { if ( binary . Length >= 32 ) return " ERROR " ; if ( num >= frac ) { binary += "1" ; num -= frac ; } else binary += "0" ; frac /= 2 ; } return binary ; } public static void Main ( ) { String output = printBinary ( num1 ) ; Console . WriteLine ( " ( 0" + output + " ) ▁ in ▁ base ▁ 2" ) ; double num2 = 0.72 ; output = printBinary ( num2 ) ; Console . WriteLine ( " ( " + output + " ) ▁ " ) ; } }

Accumulator variables: binary, frac, num
Class/struct names: BinaryToString
C# program:
using System ; class Digits { static long firstkdigits ( int n , int k ) { long product = 1 ; for ( int i = 0 ; i < n ; i ++ ) product *= n ; while ( ( int ) ( product / Math . Pow ( 10 , k ) ) != 0 ) product = product / 10 ; return product ; } public static void Main ( ) { int n = 15 ; int k = 4 ; Console . Write ( firstkdigits ( n , k ) ) ; } }

Accumulator variables: i, product
Iterator variables: i
Class/struct names: Digits
C# program:
using System ; class GFG { static bool check ( String str ) { int n = str . Length ; int digitSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) digitSum += ( str [ i ] - '0' ) ; return ( digitSum % 9 == 0 ) ; } public static void Main ( ) { String str = "99333" ; if ( check ( str ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: digitSum, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getTotalXorOfSubarrayXors ( int [ ] arr , int N ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = i ; j < N ; j ++ ) for ( int k = i ; k <= j ; k ++ ) res = res ^ arr [ k ] ; return res ; } static void Main ( ) { int [ ] arr = { 3 , 5 , 2 , 4 , 6 } ; int N = arr . Length ; Console . Write ( getTotalXorOfSubarrayXors ( arr , N ) ) ; } }

Index/key variables: k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int getTotalXorOfSubarrayXors ( int [ ] arr , int N ) { int res = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int freq = ( i + 1 ) * ( N - i ) ; if ( freq % 2 == 1 ) res = res ^ arr [ i ] ; } return res ; } public static void Main ( ) { int [ ] arr = { 3 , 5 , 2 , 4 , 6 } ; int N = arr . Length ; Console . Write ( getTotalXorOfSubarrayXors ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GCD { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findGCD ( int [ ] arr , int n ) { int result = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { result = gcd ( arr [ i ] , result ) ; if ( result == 1 ) { return 1 ; } } return result ; } public static void Main ( ) { int [ ] arr = { 2 , 4 , 6 , 8 , 16 } ; int n = arr . Length ; Console . Write ( findGCD ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GCD
C# program:
using System ; class Divisors { static int divSum ( int num ) { int result = 0 ; for ( int i = 1 ; i * i <= num ; ++ i ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return result ; } static bool isSuperPerfect ( int n ) { int n1 = divSum ( n ) ; return ( 2 * n == divSum ( n1 ) ) ; } public static void Main ( ) { int n = 16 ; Console . WriteLine ( ( isSuperPerfect ( n ) ? " Yes " : " No " ) ) ; n = 6 ; Console . WriteLine ( ( isSuperPerfect ( n ) ? " Yes " : " No " ) ) ; } }

Accumulator variables: result
Iterator variables: i
Class/struct names: Divisors
C# program:
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 " ) ; } }

Accumulator variables: divCount
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPerfectSquare ( int n ) { int sq = ( int ) Math . Sqrt ( n ) ; return ( n == sq * sq ) ; } static int countPerfectDivisors ( int n ) { int count = 0 ; for ( int i = 1 ; i * i <= n ; ++ i ) { if ( n % i == 0 ) { if ( isPerfectSquare ( i ) ) ++ count ; if ( n / i != i && isPerfectSquare ( n / i ) ) ++ count ; } } return count ; } static public void Main ( ) { int n = 16 ; Console . Write ( " Total ▁ perfect ▁ " + " divisors ▁ of ▁ " + n ) ; Console . WriteLine ( " ▁ = ▁ " + countPerfectDivisors ( n ) ) ; n = 12 ; Console . Write ( " Total ▁ perfect ▁ " + " divisors ▁ of ▁ " + n ) ; Console . WriteLine ( " ▁ = ▁ " + countPerfectDivisors ( n ) ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void nearestGcd ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; ++ i ) { int closest = - 1 ; for ( int j = i - 1 , k = i + 1 ; j > 0 k <= n ; -- j , ++ k ) { if ( j >= 0 && __gcd ( arr [ i ] , arr [ j ] ) > 1 ) { closest = j + 1 ; break ; } if ( k < n && __gcd ( arr [ i ] , arr [ k ] ) > 1 ) { closest = k + 1 ; break ; } } Console . Write ( closest + " ▁ " ) ; } } static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } public static void Main ( ) { int [ ] arr = { 2 , 9 , 4 , 3 , 13 } ; int n = arr . Length ; nearestGcd ( arr , n ) ; } }

Index/key variables: i, j, k
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 100001 ; static int [ ] prime = new int [ MAX + 1 ] ; static int [ ] countdiv = new int [ MAX + 1 ] ; static void SieveOfEratosthenes ( ) { for ( int i = 2 ; i * i <= MAX ; ++ i ) { if ( prime [ i ] == 0 ) for ( int j = i * 2 ; j <= MAX ; j += i ) prime [ j ] = i ; } for ( int i = 1 ; i < MAX ; ++ i ) if ( prime [ i ] == 0 ) prime [ i ] = i ; } static int largestGCDSubsequence ( int [ ] arr , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int element = arr [ i ] ; while ( element > 1 ) { int div = prime [ element ] ; ++ countdiv [ div ] ; ans = Math . Max ( ans , countdiv [ div ] ) ; while ( element % div == 0 ) element /= div ; } } return ans ; } public static void Main ( ) { SieveOfEratosthenes ( ) ; int [ ] arr = { 10 , 15 , 7 , 25 , 9 , 35 } ; int size = arr . Length ; Console . WriteLine ( largestGCDSubsequence ( arr , size ) ) ; } }

Index/key variables: div, element, i, j
Accumulator variables: element, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countOfBinaryNumberLessThanN ( int N ) { Queue < int > q = new Queue < int > ( ) ; q . Enqueue ( 1 ) ; int cnt = 0 ; int t ; while ( q . Count > 0 ) { t = q . Peek ( ) ; q . Dequeue ( ) ; if ( t <= N ) { cnt ++ ; q . Enqueue ( t * 10 ) ; q . Enqueue ( t * 10 + 1 ) ; } } return cnt ; } static void Main ( ) { int N = 200 ; Console . WriteLine ( countOfBinaryNumberLessThanN ( N ) ) ; } }

Accumulator variables: cnt
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumofproduct ( int n ) { int ans = 0 ; for ( int x = 1 ; x <= n ; x ++ ) { int y = n / x ; ans += ( y * x ) ; } return ans ; } static public void Main ( String [ ] args ) { int n = 10 ; Console . WriteLine ( sumofproduct ( n ) ) ; } }

Accumulator variables: ans, x
Iterator variables: x
Class/struct names: GFG
C# program:
using System ; class GFG { static int per ( int n ) { int a = 3 , b = 0 , c = 2 ; int m = 0 ; if ( n == 0 ) return a ; if ( n == 1 ) return b ; if ( n == 2 ) return c ; while ( n > 2 ) { m = a + b ; a = b ; b = c ; c = m ; n -- ; } return m ; } public static void Main ( ) { int n = 9 ; Console . WriteLine ( per ( n ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; public class GFG { static int fact ( int n ) { int num = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { num = num * i ; } return num ; } static int Special_Factorial_Number ( int k ) { for ( int i = 1 ; i <= k ; i ++ ) { if ( fact ( i ) % k == 0 ) { return i ; } } return 0 ; } public static void Main ( ) { int k = 16 ; Console . WriteLine ( Special_Factorial_Number ( k ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countMaxChoco ( int money , int price , int wrap ) { if ( money < price ) return 0 ; int choc = money / price ; choc = choc + ( choc - 1 ) / ( wrap - 1 ) ; return choc ; } public static void Main ( ) { int money = 15 ; int price = 1 ; int wrap = 3 ; Console . WriteLine ( countMaxChoco ( money , price , wrap ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int i , int j ) { if ( i == j ) return i ; if ( i > j ) return gcd ( i - j , j ) ; return gcd ( i , j - i ) ; } static bool ispossible ( int x , int y , int a , int b ) { x = Math . Abs ( x ) ; y = Math . Abs ( y ) ; a = Math . Abs ( a ) ; b = Math . Abs ( b ) ; return ( gcd ( x , y ) == gcd ( a , b ) ) ; } public static void Main ( ) { int x = 35 , y = 15 ; int a = 20 , b = 25 ; if ( ispossible ( x , y , a , b ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; public class GFG { static int MAX = 10000 ; static ArrayList primes = new ArrayList ( MAX + 1 ) ; static void sieveSundaram ( ) { bool [ ] marked = new bool [ MAX / 2 + 1 ] ; for ( int i = 1 ; i <= ( Math . Sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j = j + 2 * i + 1 ) marked [ j ] = true ; primes . Add ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . Add ( 2 * i + 1 ) ; } static bool isEquidigital ( int n ) { if ( n == 1 ) return true ; int original_no = n ; int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits ++ ; original_no = original_no / 10 ; } int pDigit = 0 , count_exp = 0 , p = 0 ; for ( int i = 0 ; ( int ) primes [ i ] <= n / 2 ; i ++ ) { while ( n % ( int ) primes [ i ] == 0 ) { p = ( int ) primes [ i ] ; n = n / p ; count_exp ++ ; } while ( p > 0 ) { pDigit ++ ; p = p / 10 ; } while ( count_exp > 1 ) { pDigit ++ ; count_exp = count_exp / 10 ; } } if ( n != 1 ) { while ( n > 0 ) { pDigit ++ ; n = n / 10 ; } } return ( pDigit == sumDigits ) ; } public static void Main ( ) { sieveSundaram ( ) ; Console . WriteLine ( " Printing ▁ first ▁ few ▁ Equidigital ▁ Numbers ▁ using ▁ isEquidigital ( ) " ) ; for ( int i = 1 ; i < 20 ; i ++ ) if ( isEquidigital ( i ) ) Console . Write ( i + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: count_exp, i, pDigit, sumDigits
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int getMaximumSumWithLCMN ( int N ) { int sum = 0 ; int LIM = ( int ) Math . Sqrt ( N ) ; for ( int i = 1 ; i <= LIM ; i ++ ) { if ( N % i == 0 ) { if ( i == ( N / i ) ) sum += i ; else sum += ( i + N / i ) ; } } return sum ; } public static void Main ( ) { int N = 12 ; Console . Write ( getMaximumSumWithLCMN ( N ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int hcf ( int a , int b ) { if ( b == 0 ) return a ; return hcf ( b , a % b ) ; } static int findlcm ( int a , int b ) { if ( b == 1 ) return a ; a = ( a * b ) / hcf ( a , b ) ; b -= 1 ; return findlcm ( a , b ) ; } static void Main ( ) { int n = 7 ; if ( n < 3 ) Console . Write ( n ) ; else Console . Write ( findlcm ( n , n - 1 ) ) ; } }

Accumulator variables: b
Class/struct names: GFG
C# program:
using System ; public class GFG { static long gcd ( long a , long b ) { if ( a % b != 0 ) return gcd ( b , a % b ) ; else return b ; } static long lcm ( long n ) { long ans = 1 ; for ( long i = 1 ; i <= n ; i ++ ) ans = ( ans * i ) / ( gcd ( ans , i ) ) ; return ans ; } static public void Main ( ) { long n = 20 ; Console . WriteLine ( lcm ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static float y ( float x ) { return 1 / ( 1 + x * x ) ; } static float trapezoidal ( float a , float b , float n ) { float h = ( b - a ) / n ; float s = y ( a ) + y ( b ) ; for ( int i = 1 ; i < n ; i ++ ) s += 2 * y ( a + i * h ) ; return ( h / 2 ) * s ; } public static void Main ( ) { float x0 = 0 ; float xn = 1 ; int n = 6 ; Console . Write ( " Value ▁ of ▁ integral ▁ is ▁ " + Math . Round ( trapezoidal ( x0 , xn , n ) * 10000.0 ) / 10000.0 ) ; } }

Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxProd ( int n ) { if ( n == 2 n == 3 ) return ( n - 1 ) ; int res = 1 ; while ( n > 4 ) { n -= 3 ; res *= 3 ; } return ( n * res ) ; } static void Main ( ) { Console . WriteLine ( " Maximum ▁ Product ▁ is ▁ " + maxProd ( 45 ) ) ; } }

Accumulator variables: n, res
Class/struct names: GFG
C# program:
using System ; class GFG { static double numberOfDigits ( double n ) { if ( n == 1 ) return 1 ; double d = ( n * Math . Log10 ( 1.6180339887498948 ) ) - ( ( Math . Log10 ( 5 ) ) / 2 ) ; return Math . Ceiling ( d ) ; } public static void Main ( ) { double i ; for ( i = 1 ; i <= 10 ; i ++ ) Console . WriteLine ( " Number ▁ of ▁ Digits ▁ in ▁ F ( " + i + " ) ▁ - ▁ " + numberOfDigits ( i ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int countOddSquares ( int n , int m ) { return ( int ) Math . Pow ( ( double ) m , 0.5 ) - ( int ) Math . Pow ( ( double ) n - 1 , 0.5 ) ; } public static void Main ( ) { int n = 5 , m = 100 ; Console . Write ( " Count ▁ is ▁ " + countOddSquares ( n , m ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static void boomNumber ( long k ) { Queue q = new Queue ( ) ; q . Enqueue ( " " ) ; long count = 0 ; while ( count <= k ) { string s1 = ( string ) q . Dequeue ( ) ; string s2 = s1 ; s1 += "2" ; q . Enqueue ( s1 ) ; count ++ ; if ( count == k ) { Console . Write ( s1 ) ; break ; } s2 += "3" ; q . Enqueue ( s2 ) ; count ++ ; if ( count == k ) { Console . Write ( s2 ) ; break ; } } return ; } public static void Main ( string [ ] arg ) { long k = 1000000 ; boomNumber ( k ) ; } }

Accumulator variables: count, s1, s2
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool factors ( int n , int k ) { List < int > v = new List < int > ( ) ; while ( n % 2 == 0 ) { v . Add ( 2 ) ; n /= 2 ; } if ( v . Count >= k ) return true ; for ( int i = 3 ; i * i <= n ; i += 2 ) { while ( n % i == 0 ) { n = n / i ; v . Add ( i ) ; } if ( v . Count >= k ) return true ; } if ( n > 2 ) v . Add ( n ) ; if ( v . Count >= k ) return true ; return false ; } static void operation ( int n , int k ) { bool answered = false ; if ( n < k ) { answered = true ; Console . WriteLine ( " No " ) ; } bool ok = factors ( n , k ) ; if ( ! ok && ! answered ) { answered = true ; Console . WriteLine ( " No " ) ; } if ( ok && ! answered ) Console . WriteLine ( " Yes " ) ; } public static void Main ( ) { int n = 4 ; int k = 2 ; operation ( n , k ) ; } }

Accumulator variables: i, n
Iterator variables: i
Boolean variables: answered
Class/struct names: GFG
C# program:
using System ; class GFG { static void sieve ( int n , int [ ] prime ) { for ( int i = 1 ; i <= n ; i ++ ) prime [ i ] = 1 ; prime [ 1 ] = 0 ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( prime [ i ] == 1 ) { for ( int j = i * i ; j <= n ; j += i ) prime [ j ] = 0 ; } } } static int expFactor ( int n , int p ) { int x = p ; int exponent = 0 ; while ( ( n / x ) > 0 ) { exponent += n / x ; x *= p ; } return exponent ; } static long countFactors ( int n ) { long ans = 1 ; int [ ] prime = new int [ n + 1 ] ; sieve ( n , prime ) ; for ( int p = 1 ; p <= n ; p ++ ) { if ( prime [ p ] == 1 ) ans *= ( expFactor ( n , p ) + 1 ) ; } return ans ; } public static void Main ( ) { int n = 16 ; Console . Write ( " Count ▁ of ▁ factors ▁ of ▁ " + n + " ▁ is ▁ " + countFactors ( n ) ) ; } }

Index/key variables: i, j, p
Accumulator variables: ans, exponent, i, j, p, x
Iterator variables: i, j, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int __gcd ( int a , int b ) { if ( a == 0 ) return b ; return __gcd ( b % a , a ) ; } static int LcmOfArray ( int [ ] arr , int idx ) { if ( idx == arr . Length - 1 ) { return arr [ idx ] ; } int a = arr [ idx ] ; int b = LcmOfArray ( arr , idx + 1 ) ; return ( a * b / __gcd ( a , b ) ) ; } static void Main ( ) { int [ ] arr = { 1 , 2 , 8 , 3 } ; Console . WriteLine ( LcmOfArray ( arr , 0 ) ) ; int [ ] arr1 = { 2 , 7 , 3 , 9 , 4 } ; Console . WriteLine ( LcmOfArray ( arr1 , 0 ) ) ; } }

Index/key variables: idx
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool isPower ( int x , int y ) { if ( x == 1 ) return ( y == 1 ) ; int pow = 1 ; while ( pow < y ) pow = pow * x ; return ( pow == y ) ; } public static void Main ( ) { Console . WriteLine ( isPower ( 10 , 1 ) ? 1 : 0 ) ; Console . WriteLine ( isPower ( 1 , 20 ) ? 1 : 0 ) ; Console . WriteLine ( isPower ( 2 , 128 ) ? 1 : 0 ) ; Console . WriteLine ( isPower ( 2 , 30 ) ? 1 : 0 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static double countSquares ( int a , int b ) { return ( Math . Floor ( Math . Sqrt ( b ) ) - Math . Ceiling ( Math . Sqrt ( a ) ) + 1 ) ; } public static void Main ( ) { int a = 9 , b = 25 ; Console . Write ( " Count ▁ of ▁ squares ▁ is ▁ " + ( int ) countSquares ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findCountUpto ( int d ) { int GP1_Sum = 9 * ( ( int ) ( ( Math . Pow ( 10 , d ) ) - 1 ) / 9 ) ; int GP2_Sum = 9 * ( ( int ) ( ( Math . Pow ( 9 , d ) ) - 1 ) / 8 ) ; return GP1_Sum - GP2_Sum ; } public static void Main ( ) { int d = 1 ; Console . WriteLine ( findCountUpto ( d ) ) ; d = 2 ; Console . WriteLine ( findCountUpto ( d ) ) ; d = 4 ; Console . WriteLine ( findCountUpto ( d ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void countDivisors ( int n ) { int count = 0 ; for ( int i = 1 ; i <= Math . Sqrt ( n ) + 1 ; i ++ ) { if ( n % i == 0 ) count += ( n / i == i ) ? 1 : 2 ; } if ( count % 2 == 0 ) Console . Write ( " Even " ) ; else Console . Write ( " Odd " ) ; } public static void Main ( ) { Console . Write ( " The ▁ count ▁ of ▁ divisor : ▁ " ) ; countDivisors ( 10 ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int greyConverter ( int n ) { return n ^ ( n >> 1 ) ; } public static void Main ( string [ ] args ) { int n = 3 ; Console . WriteLine ( greyConverter ( n ) ) ; n = 9 ; Console . WriteLine ( greyConverter ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int largestPower ( int n , int p ) { int x = 0 ; while ( n > 0 ) { n /= p ; x += n ; } return x ; } static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( y % 2 == 1 ) { res = ( res * x ) % p ; } x = ( x * x ) % p ; } return res ; } static int modFact ( int n , int p ) { if ( n >= p ) { return 0 ; } int res = 1 ; bool [ ] isPrime = new bool [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) isPrime [ i ] = true ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( isPrime [ i ] ) { for ( int j = 2 * i ; j <= n ; j += i ) { isPrime [ j ] = false ; } } } for ( int i = 2 ; i <= n ; i ++ ) { if ( isPrime [ i ] ) { int k = largestPower ( n , i ) ; res = ( res * power ( i , k , p ) ) % p ; } } return res ; } static public void Main ( ) { int n = 25 , p = 29 ; Console . WriteLine ( modFact ( n , p ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, n, x
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSquares ( int m , int n ) { if ( n < m ) { int temp = m ; m = n ; n = temp ; } return m * ( m + 1 ) * ( 2 * m + 1 ) / 6 + ( n - m ) * m * ( m + 1 ) / 2 ; } public static void Main ( ) { int m = 4 , n = 3 ; Console . WriteLine ( " Count ▁ of ▁ squares ▁ is ▁ " + countSquares ( m , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int sumBitDiff ( int [ ] arr ) { for ( int i = 0 ; i < arr . Length ; i ++ ) { for ( int j = i ; j < arr . Length ; j ++ ) { int xor = arr [ i ] ^ arr [ j ] ; diff += 2 * count ; } } return diff ; } static int countSetBits ( int n ) { while ( n != 0 ) { count ++ ; } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 10 } ; int ans = sumBitDiff ( arr ) ; Console . WriteLine ( ans ) ; } }

Index/key variables: i, j
Accumulator variables: count, diff, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int add ( int x , int y ) { while ( y > 0 && y != 0 ) { x ++ ; y -- ; } while ( y < 0 && y != 0 ) { x -- ; y ++ ; } return x ; } public static void Main ( ) { Console . WriteLine ( add ( 43 , 23 ) ) ; Console . WriteLine ( add ( 43 , - 23 ) ) ; } }

Accumulator variables: x, y
Class/struct names: GFG
C# program:
using System ; public class GFG { static int countFact ( int low , int high ) { int fact = 1 , x = 1 ; while ( fact < low ) { fact = fact * x ; x ++ ; } int res = 0 ; while ( fact <= high ) { res ++ ; fact = fact * x ; x ++ ; } return res ; } public static void Main ( ) { Console . Write ( " Count ▁ is ▁ " + countFact ( 2 , 720 ) ) ; } }

Accumulator variables: res, x
Class/struct names: GFG