dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int findN ( int k ) { int ans ; if ( k == 0 ) ans = 3 ; if ( k == 1 ) ans = 1 ; else if ( k % 4 == 0 ) ans = k ; else if ( k % 4 == 3 ) ans = k - 1 ; else ans = - 1 ; return ans ; } public static void Main ( ) { int k = 7 ; int res = findN ( k ) ; if ( res == - 1 ) Console . WriteLine ( " Not ▁ possible " ) ; else Console . WriteLine ( res ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int Circular ( int n ) { int Result = 1 ; while ( n > 0 ) { Result = Result * n ; n -- ; } return Result ; } public static void Main ( ) { int n = 4 ; Console . Write ( Circular ( n - 1 ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static double calTime ( double [ ] arr , int n ) { double work = 0 ; for ( int i = 0 ; i < n ; i ++ ) work += 1 / arr [ i ] ; return Math . Round ( 1 / work , 5 ) ; } public static void Main ( ) { double [ ] arr = { 6.0 , 3.0 , 4.0 } ; int n = arr . Length ; Console . Write ( calTime ( arr , n ) + " ▁ Hours " ) ; } }

Index/key variables: i
Accumulator variables: i, work
Iterator variables: i
Class/struct names: GFG
C# program:
class GFG { static void printTwins ( int low , int high ) { bool [ ] prime = new bool [ high + 1 ] ; bool twin = false ; for ( int i = 0 ; i < high + 1 ; i ++ ) prime [ i ] = true ; prime [ 0 ] = prime [ 1 ] = false ; for ( int p = 2 ; p <= System . Math . Floor ( System . Math . Sqrt ( high ) ) + 1 ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i <= high ; i += p ) prime [ i ] = false ; } } for ( int i = high ; i >= low ; i -- ) { if ( prime [ i ] && ( i - 2 >= low && prime [ i - 2 ] == true ) ) { System . Console . WriteLine ( " Largest ▁ twins ▁ in ▁ given ▁ range : ▁ ( " + ( i - 2 ) + " , ▁ " + ( i ) + " ) " ) ; twin = true ; break ; } } if ( twin == false ) System . Console . WriteLine ( " No ▁ such ▁ pair ▁ exists " ) ; } public static void Main ( ) { printTwins ( 10 , 100 ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Boolean variables: twin
Class/struct names: GFG
C# program:
class GFG { static int prevComplement ( int n , int b ) { int maxDigit , maxNum = 0 , digits = 0 , num = n ; while ( n != 0 ) { digits ++ ; n = n / 10 ; } maxDigit = b - 1 ; while ( ( digits -- ) > 0 ) { maxNum = maxNum * 10 + maxDigit ; } return maxNum - num ; } static int complement ( int n , int b ) { return prevComplement ( n , b ) + 1 ; } public static void Main ( ) { System . Console . WriteLine ( prevComplement ( 25 , 7 ) ) ; System . Console . WriteLine ( complement ( 25 , 7 ) ) ; } }

Accumulator variables: digits
Class/struct names: GFG
C# program:
using System ; class GFG { public static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static public void Main ( ) { int a = 2 ; int b = 4 ; Console . WriteLine ( gcd ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MaximumDivisors ( int X , int Y ) { int [ ] arr = new int [ Y - X + 1 ] ; for ( int i = 0 ; i < arr . Length ; i ++ ) arr [ i ] = 0 ; int mx = 0 ; int cnt = 0 ; for ( int i = 1 ; i * i <= Y ; i ++ ) { int sq = i * i ; int first_divisible ; if ( ( X / i ) * i >= X ) first_divisible = ( X / i ) * i ; else first_divisible = ( X / i + 1 ) * i ; for ( int j = first_divisible ; j <= Y ; j += i ) { if ( j < sq ) continue ; else if ( j == sq ) arr [ j - X ] ++ ; else arr [ j - X ] += 2 ; } } for ( int i = X ; i <= Y ; i ++ ) { if ( arr [ i - X ] > mx ) { cnt = 1 ; mx = arr [ i - X ] ; } else if ( arr [ i - X ] == mx ) cnt ++ ; } return cnt ; } public static void Main ( ) { int X = 1 , Y = 10 ; Console . Write ( MaximumDivisors ( X , Y ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static int NearestElement ( int A , int D , int P ) { if ( A == 0 ) return 0 ; else if ( D == 0 ) return - 1 ; else { int X = power ( D , P - 2 , P ) ; return ( X * ( P - A ) ) % P ; } } public static void Main ( ) { int A = 4 , D = 9 , P = 11 ; A %= P ; D %= P ; Console . WriteLine ( NearestElement ( A , D , P ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void print ( int p0 ) { int p1 , i = 0 , x , flag , k ; while ( true ) { flag = 1 ; x = ( int ) ( Math . Pow ( 2 , i ) ) ; p1 = x * p0 + ( x - 1 ) ; for ( k = 2 ; k < p1 ; k ++ ) { if ( p1 % k == 0 ) { flag = 0 ; break ; } } if ( flag == 0 ) break ; Console . Write ( " ▁ " + p1 ) ; i ++ ; } } public static void Main ( ) { int p0 = 2 ; print ( p0 ) ; } }

Accumulator variables: i, k
Iterator variables: k
Class/struct names: GFG
C# program:
using System ; class GFG { static int findOddPair ( int [ ] A , int N ) { int i , j ; int oddPair = 0 ; for ( i = 0 ; i < N ; i ++ ) { for ( j = i + 1 ; j < N ; j ++ ) { if ( ( A [ i ] & A [ j ] ) % 2 != 0 ) oddPair ++ ; } } return oddPair ; } public static void Main ( ) { int [ ] a = { 5 , 1 , 3 , 2 } ; int n = a . Length ; Console . WriteLine ( findOddPair ( a , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, oddPair
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int summ ( int n ) { if ( n == 0 ) return 0 ; return ( n % 9 == 0 ) ? 9 : ( n % 9 ) ; } static void printDigitalRoot ( int n ) { int maxi = 1 ; int dig = 1 ; for ( int i = 1 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { int d1 = summ ( n / i ) ; int d2 = summ ( i ) ; if ( d1 > maxi ) { dig = n / i ; maxi = d1 ; } if ( d2 > maxi ) { dig = i ; maxi = d2 ; } if ( d1 == maxi ) { if ( dig < ( n / i ) ) { dig = n / i ; maxi = d1 ; } } if ( d2 == maxi ) { if ( dig < i ) { dig = i ; maxi = d2 ; } } } } Console . WriteLine ( dig + " ▁ " + maxi ) ; } public static void Main ( ) { int n = 10 ; printDigitalRoot ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static long calculateSum ( int n ) { long sum = 0 ; sum = 1 << n ; return ( sum - 1 ) ; } static public void Main ( ) { int n = 10 ; Console . WriteLine ( " Sum ▁ of ▁ all ▁ elements : " + calculateSum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void Divide ( int a , int b ) { long dividend = ( long ) a ; long divisor = ( long ) b ; long sign = ( dividend < 0 ) ^ ( divisor < 0 ) ? - 1 : 1 ; dividend = Math . Abs ( dividend ) ; divisor = Math . Abs ( divisor ) ; if ( divisor == 0 ) { Console . WriteLine ( " Cannot ▁ Divide ▁ by ▁ 0" ) ; return ; } if ( dividend == 0 ) { Console . WriteLine ( a + " ▁ / ▁ " + b + " ▁ is ▁ equal ▁ to ▁ : ▁ " + 0 ) ; return ; } if ( divisor == 1 ) { Console . WriteLine ( a + " ▁ / ▁ " + b + " ▁ is ▁ equal ▁ to ▁ : ▁ " + sign * dividend ) ; return ; } Console . WriteLine ( a + " ▁ / ▁ " + b + " ▁ is ▁ equal ▁ to ▁ : ▁ " + Math . Floor ( sign * ( Math . Exp ( Math . Log ( dividend ) - Math . Log ( divisor ) ) ) ) ) ; } public static void Main ( ) { int a = 10 , b = 5 ; Divide ( a , b ) ; a = 49 ; b = - 7 ; Divide ( a , b ) ; } }

Class/struct names: GFG
C# program:
class GFG { static bool findNature ( int a , int b , int n ) { if ( n == 0 ) return ( a & 1 ) == 1 ? true : false ; if ( n == 1 ) return ( b & 1 ) == 1 ? true : false ; if ( ( a & 1 ) == 0 ) { if ( ( b & 1 ) == 0 ) return false ; else return ( n % 3 != 0 ) ; } else { if ( ( b & 1 ) == 0 ) return ( ( n - 1 ) % 3 != 0 ) ; else return ( ( n + 1 ) % 3 != 0 ) ; } } static void Main ( ) { int a = 2 , b = 4 ; int n = 3 ; if ( findNature ( a , b , n ) ) System . Console . WriteLine ( " Odd " ) ; else System . Console . WriteLine ( " Even " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static string checkEqual ( string S ) { for ( int i = 0 ; i < S . Length ; i ++ ) { if ( S [ i ] != '1' && S [ i ] != '0' && S [ i ] != '8' ) { return " No " ; } } int start = 0 , end = S . Length - 1 ; while ( start < end ) { if ( S [ start ] != S [ end ] ) { return " No " ; } start ++ ; end -- ; } return " Yes " ; } public static void Main ( ) { string S = "101" ; Console . WriteLine ( checkEqual ( S ) ) ; } }

Index/key variables: end, i, start
Accumulator variables: end, i, start
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void check_polydivisible ( int n ) { int N = n ; List < int > digit = new List < int > ( ) ; while ( n > 0 ) { digit . Add ( ( int ) n % 10 ) ; n /= 10 ; } digit . Reverse ( ) ; bool flag = true ; n = digit [ 0 ] ; for ( int i = 1 ; i < digit . Count ; i ++ ) { n = n * 10 + digit [ i ] ; if ( n % ( i + 1 ) != 0 ) { flag = false ; break ; } } if ( flag ) Console . WriteLine ( N + " ▁ is ▁ Polydivisible ▁ number . " ) ; else Console . WriteLine ( N + " ▁ is ▁ Not ▁ Polydivisible ▁ number . " ) ; } public static void Main ( String [ ] args ) { int n = 345654 ; check_polydivisible ( n ) ; } }

Index/key variables: i
Accumulator variables: i, n
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static int Log2n ( int n ) { return ( n > 1 ) ? 1 + Log2n ( n / 2 ) : 0 ; } static bool isPowerOfd ( int n , int d ) { int count = 0 ; if ( n > 0 && ( n & ( n - 1 ) ) == 0 ) { while ( n > 1 ) { n >>= 1 ; count += 1 ; } return ( count % ( Log2n ( d ) ) == 0 ) ; } return false ; } static void Main ( ) { int n = 64 , d = 8 ; if ( isPowerOfd ( n , d ) ) Console . WriteLine ( " { 0 } ▁ is ▁ a ▁ " + " power ▁ of ▁ { 1 } " , n , d ) ; else Console . WriteLine ( " { 0 } ▁ is ▁ not ▁ a " + " ▁ power ▁ of ▁ { 1 } " , n , d ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static readonly int MAX = 1001 ; static List < int > [ ] adj = new List < int > [ MAX ] ; static void add_edge ( int u , int v ) { adj [ u ] . Add ( v ) ; } static void checkTotalNumberofNodes ( int actualAnswer , int size ) { int calculatedAnswer = size ; for ( int i = 1 ; i <= size ; i ++ ) calculatedAnswer += adj [ i ] . Count ; if ( actualAnswer == calculatedAnswer ) Console . Write ( " Calculated ▁ Answer ▁ is ▁ " + calculatedAnswer + " ▁ and ▁ is ▁ Equal ▁ to ▁ Actual ▁ Answer STRNEWLINE " ) ; else Console . Write ( " Calculated ▁ Answer ▁ " + " is ▁ Incorrect STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { for ( int i = 0 ; i < MAX ; i ++ ) adj [ i ] = new List < int > ( ) ; int N = 8 ; add_edge ( 1 , 2 ) ; add_edge ( 1 , 3 ) ; add_edge ( 2 , 4 ) ; add_edge ( 2 , 5 ) ; add_edge ( 3 , 6 ) ; add_edge ( 3 , 7 ) ; add_edge ( 6 , 8 ) ; checkTotalNumberofNodes ( 2 * N - 1 , N ) ; for ( int i = 1 ; i <= N ; i ++ ) adj [ i ] . Clear ( ) ; N = 9 ; add_edge ( 1 , 2 ) ; add_edge ( 1 , 3 ) ; add_edge ( 2 , 4 ) ; add_edge ( 2 , 5 ) ; add_edge ( 2 , 6 ) ; add_edge ( 3 , 9 ) ; add_edge ( 5 , 7 ) ; add_edge ( 5 , 8 ) ; checkTotalNumberofNodes ( 2 * N - 1 , N ) ; } }

Index/key variables: MAX, i, u
Accumulator variables: calculatedAnswer, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int octahedral_num ( int n ) { return n * ( 2 * n * n + 1 ) / 3 ; } static public void Main ( ) { int n = 5 ; Console . Write ( n + " th ▁ Octahedral " + " ▁ number : ▁ " ) ; Console . WriteLine ( octahedral_num ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int centeredTetrahedralNumber ( int n ) { return ( 2 * n + 1 ) * ( n * n + n + 3 ) / 3 ; } public static void Main ( ) { int n = 6 ; Console . WriteLine ( centeredTetrahedralNumber ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void swap ( int a , int b , int c , int d ) { a = a + b ; b = a - b ; a = a - b ; b = b + c ; c = b - c ; b = b - c ; c = c + d ; d = c - d ; c = c - d ; Console . WriteLine ( " values ▁ after ▁ " + " swapping ▁ are ▁ : ▁ " ) ; Console . WriteLine ( " a ▁ = ▁ " + a ) ; Console . WriteLine ( " b ▁ = ▁ " + b ) ; Console . WriteLine ( " c ▁ = ▁ " + c ) ; Console . WriteLine ( " d ▁ = ▁ " + d ) ; } public static void Main ( ) { int a = 1 ; int b = 2 ; int c = 3 ; int d = 4 ; Console . WriteLine ( " values ▁ before ▁ " + " swapping ▁ are ▁ : ▁ " ) ; Console . WriteLine ( " a ▁ = ▁ " + a ) ; Console . WriteLine ( " b ▁ = ▁ " + b ) ; Console . WriteLine ( " c ▁ = ▁ " + c ) ; Console . WriteLine ( " d ▁ = ▁ " + d ) ; Console . WriteLine ( " " ) ; swap ( a , b , c , d ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int seriesSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += i * ( i + 1 ) / 2 ; return sum ; } public static void Main ( ) { int n = 4 ; Console . WriteLine ( seriesSum ( n ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkCentrosymmetricted ( int n , int [ , ] m ) { int mid_row ; if ( ( n & 1 ) > 0 ) mid_row = n / 2 + 1 ; else mid_row = n / 2 ; for ( int i = 0 ; i < mid_row ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( m [ i , j ] != m [ n - i - 1 , n - j - 1 ] ) return false ; } } return true ; } public static void Main ( ) { int n = 3 ; int [ , ] m = { { 1 , 3 , 5 } , { 6 , 8 , 6 } , { 5 , 3 , 1 } } ; if ( checkCentrosymmetricted ( n , m ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int Centered_Triangular_num ( int n ) { return ( 3 * n * n + 3 * n + 2 ) / 2 ; } static public void Main ( ) { int n = 3 ; Console . WriteLine ( Centered_Triangular_num ( n ) ) ; n = 12 ; Console . WriteLine ( Centered_Triangular_num ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findGCD ( List < int > arr , int n ) { int result = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) result = gcd ( arr [ i ] , result ) ; return result ; } static void compute ( List < int > arr , int n ) { List < int > answer = new List < int > ( ) ; int GCD_of_array = findGCD ( arr , n ) ; if ( GCD_of_array == arr [ 0 ] ) { answer . Add ( arr [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { answer . Add ( arr [ 0 ] ) ; answer . Add ( arr [ i ] ) ; } for ( int i = 0 ; i < answer . Count ; i ++ ) Console . Write ( answer [ i ] + " ▁ " ) ; } else Console . Write ( " No ▁ array ▁ " + " can ▁ be ▁ build " ) ; } static void Main ( ) { int n = 3 ; int [ ] input = new int [ ] { 2 , 5 , 6 , 7 , 11 } ; HashSet < int > GCD = new HashSet < int > ( input ) ; List < int > arr = new List < int > ( ) ; foreach ( int b in GCD ) arr . Add ( b ) ; compute ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: b, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int binomialCoeff ( int n , int k ) { int [ , ] C = new int [ n + 1 , k + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= Math . Min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i , j ] = 1 ; else C [ i , j ] = C [ i - 1 , j - 1 ] + C [ i - 1 , j ] ; } } return C [ n , k ] ; } static int k_Leaves ( int n , int k ) { int ans = ( binomialCoeff ( n , k ) * binomialCoeff ( n , k - 1 ) ) / n ; Console . WriteLine ( " Number ▁ of ▁ trees ▁ " + " having ▁ 4 ▁ edges ▁ and ▁ exactly ▁ 2 ▁ " + " leaves ▁ : ▁ " + ans ) ; return 0 ; } static int numberOfNodes ( int n , int d ) { int ans = binomialCoeff ( 2 * n - 1 - d , n - 1 ) ; Console . WriteLine ( " Number ▁ of ▁ nodes ▁ " + " of ▁ degree ▁ 1 ▁ in ▁ a ▁ tree ▁ having ▁ 4 ▁ " + " edges ▁ : ▁ " + ans ) ; return 0 ; } static int rootDegreeR ( int n , int r ) { int ans = r * binomialCoeff ( 2 * n - 1 - r , n - 1 ) ; ans = ans / n ; Console . WriteLine ( " Number ▁ of ▁ trees ▁ " + " having ▁ 4 ▁ edges ▁ where ▁ root ▁ has " + " ▁ degree ▁ 2 ▁ : ▁ " + ans ) ; return 0 ; } public static void Main ( ) { k_Leaves ( 3 , 2 ) ; numberOfNodes ( 3 , 1 ) ; rootDegreeR ( 3 , 2 ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { public static int repUnitValue ( int n ) { if ( n % 2 == 0 n % 5 == 0 ) return 0 ; int rem = 1 ; int power = 1 ; int k = 1 ; while ( rem % n != 0 ) { k ++ ; power = power * 10 % n ; rem = ( rem + power ) % n ; } return k ; } public static void Main ( ) { int n = 13 ; Console . Write ( repUnitValue ( n ) ) ; } }

Accumulator variables: k
Class/struct names: GFG
C# program:
using System ; class GFG { static int GCD ( int a , int b ) { return b == 0 ? a : GCD ( b , a % b ) ; } static bool isSplittable ( int n , int m ) { int total_sum = ( n * ( n + 1 ) ) / 2 ; int sum_s1 = ( total_sum + m ) / 2 ; int sum_s2 = total_sum - sum_s1 ; if ( total_sum < m ) return false ; if ( sum_s1 + sum_s2 == total_sum && sum_s1 - sum_s2 == m ) return ( GCD ( sum_s1 , sum_s2 ) == 1 ) ; return false ; } public static void Main ( ) { int n = 5 , m = 7 ; if ( isSplittable ( n , m ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPossibleToZero ( int [ ] a , int n ) { int num = 0 ; for ( int i = 0 ; i < n ; i ++ ) num = num * 10 + a [ i ] ; return ( num % 11 == 0 ) ; } public static void Main ( ) { int [ ] arr = { 0 , 1 , 1 , 0 } ; int n = arr . Length ; if ( isPossibleToZero ( arr , n ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool isBlumInteger ( int n ) { bool [ ] prime = new bool [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) prime [ i ] = true ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( prime [ i ] == true ) { for ( int j = i * 2 ; j <= n ; j += i ) prime [ j ] = false ; } } for ( int i = 2 ; i <= n ; i ++ ) { if ( prime [ i ] ) { if ( ( n % i == 0 ) && ( ( i - 3 ) % 4 ) == 0 ) { int q = n / i ; return ( q != i && prime [ q ] && ( q - 3 ) % 4 == 0 ) ; } } } return false ; } static public void Main ( ) { int n = 249 ; if ( isBlumInteger ( n ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, j, q
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int nCr ( int n , int r ) { return fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; } static int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } public static void Main ( ) { int n = 5 , r = 3 ; Console . Write ( nCr ( n , r ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int summingSeries ( long n ) { return ( int ) Math . Pow ( n , 2 ) ; } public static void Main ( ) { int n = 100 ; Console . Write ( " The ▁ sum ▁ of ▁ n ▁ term ▁ is : ▁ " + summingSeries ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void find_sum_of_two_squares ( int a , int b ) { int ab = a * b ; for ( int i = 0 ; i * i <= ab ; i ++ ) { for ( int j = i ; i * i + j * j <= ab ; j ++ ) { if ( i * i + j * j == ab ) Console . Write ( i + " ^ 2 ▁ + ▁ " + j + " ^ 2 ▁ = ▁ " + ab + " STRNEWLINE " ) ; } } } public static void Main ( ) { int a = 1 * 1 + 2 * 2 ; int b = 3 * 3 + 4 * 4 ; Console . Write ( " Representation ▁ of ▁ a ▁ * ▁ b ▁ " + " as ▁ sum ▁ of ▁ 2 ▁ squares : STRNEWLINE " ) ; find_sum_of_two_squares ( a , b ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int tetrahedralNumber ( int n ) { return ( n * ( n + 1 ) * ( n + 2 ) ) / 6 ; } static public void Main ( ) { int n = 5 ; Console . WriteLine ( tetrahedralNumber ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void check_euler_four_square_identity ( int a , int b , int ab ) { int s = 0 ; for ( int i = 0 ; i * i <= ab ; i ++ ) { s = i * i ; for ( int j = i ; j * j <= ab ; j ++ ) { s = j * j + i * i ; for ( int k = j ; k * k <= ab ; k ++ ) { s = k * k + j * j + i * i ; for ( int l = k ; l * l <= ab ; l ++ ) { s = l * l + k * k + j * j + i * i ; if ( s == ab ) { Console . Write ( " i ▁ = ▁ " + i + " STRNEWLINE " ) ; Console . Write ( " j ▁ = ▁ " + j + " STRNEWLINE " ) ; Console . Write ( " k ▁ = ▁ " + k + " STRNEWLINE " ) ; Console . Write ( " l ▁ = ▁ " + l + " STRNEWLINE " ) ; Console . Write ( " Product ▁ of ▁ " + a + " ▁ and ▁ " + b ) ; Console . Write ( " ▁ can ▁ be ▁ written " + " ▁ as ▁ sum ▁ of ▁ squares ▁ of ▁ i , ▁ " + " j , ▁ k , ▁ l STRNEWLINE " ) ; Console . Write ( ab + " ▁ = ▁ " ) ; Console . Write ( i + " * " + i + " ▁ + ▁ " ) ; Console . Write ( j + " * " + j + " ▁ + ▁ " ) ; Console . Write ( k + " * " + k + " ▁ + ▁ " ) ; Console . Write ( l + " * " + l + " STRNEWLINE " ) ; Console . Write ( " STRNEWLINE " ) ; } } } } } } static void Main ( ) { int ab = a * b ; check_euler_four_square_identity ( a , b , ab ) ; } }

Accumulator variables: i, j, k, l
Iterator variables: i, j, k, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int calculateDivisors ( int A , int B ) { int N = ( A - B ) ; int noOfDivisors = 0 ; double a = Math . Sqrt ( N ) ; for ( int i = 1 ; i <= ( int ) ( a ) ; i ++ ) { if ( ( N % i ) == 0 ) { if ( i > B ) noOfDivisors ++ ; if ( ( N / i ) != i && ( N / i ) > B ) noOfDivisors ++ ; } } return noOfDivisors ; } static int numberOfPossibleWaysUtil ( int A , int B ) { if ( A == B ) return - 1 ; if ( A < B ) return 0 ; int noOfDivisors = 0 ; noOfDivisors = calculateDivisors ( A , B ) ; return noOfDivisors ; } public static void numberOfPossibleWays ( int A , int B ) { int noOfSolutions = numberOfPossibleWaysUtil ( A , B ) ; if ( noOfSolutions == - 1 ) { Console . Write ( " For ▁ A ▁ = ▁ " + A + " ▁ and ▁ B ▁ = ▁ " + B + " , ▁ X ▁ can ▁ take ▁ Infinitely ▁ many ▁ values " + " ▁ greater ▁ than ▁ " + A + " STRNEWLINE " ) ; } else { Console . Write ( " For ▁ A ▁ = ▁ " + A + " ▁ and ▁ B ▁ = ▁ " + B + " , ▁ X ▁ can ▁ take ▁ " + noOfSolutions + " ▁ values STRNEWLINE " ) ; } } public static void Main ( ) { int A = 26 , B = 2 ; numberOfPossibleWays ( A , B ) ; A = 21 ; B = 5 ; numberOfPossibleWays ( A , B ) ; } }

Accumulator variables: i, noOfDivisors
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long powerNumbers ( int n ) { HashSet < long > v = new HashSet < long > ( ) ; for ( long i = 2 ; i * i * i <= n ; i ++ ) { long j = i * i ; while ( j * i <= n ) { j *= i ; long s = ( long ) Math . Sqrt ( j ) ; if ( s * s != j ) v . Add ( j ) ; } } return v . Count + ( long ) Math . Sqrt ( n ) ; } static void Main ( ) { Console . Write ( powerNumbers ( 50 ) ) ; } }

Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int mean ( int [ , ] a , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) sum += a [ i , j ] ; return sum / ( n * n ) ; } static int variance ( int [ , ] a , int n , int m ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { a [ i , j ] -= m ; a [ i , j ] *= a [ i , j ] ; } } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) sum += a [ i , j ] ; return sum / ( n * n ) ; } static public void Main ( ) { int [ , ] mat = { { 1 , 2 , 3 } , { 4 , 5 , 6 } , { 7 , 8 , 9 } } ; int m = mean ( mat , 3 ) ; int var = variance ( mat , 3 , m ) ; double dev = ( int ) Math . Sqrt ( var ) ; Console . WriteLine ( " Mean : ▁ " + m ) ; Console . WriteLine ( " Variance : ▁ " + var ) ; Console . WriteLine ( " Deviation : ▁ " + dev ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumofseries ( int n ) { return ( n * ( n + 1 ) * ( n + 2 ) * ( n + 3 ) / 4 ) ; } public static void Main ( ) { Console . WriteLine ( sumofseries ( 3 ) ) ; } }

Class/struct names: GFG