dhyuti-n/xlcost-variable-roles huggingface dataset:
C program:
#include <math.h>
#include <stdio.h>
int countDigitSum ( int N , int K ) { int l = ( int ) pow ( 10 , N - 1 ) , r = ( int ) pow ( 10 , N ) - 1 ; int count = 0 ; for ( int i = l ; i <= r ; i ++ ) { int num = i ; int digits [ N ] ; for ( int j = N - 1 ; j >= 0 ; j -- ) { digits [ j ] = num % 10 ; num /= 10 ; } int sum = 0 , flag = 0 ; for ( int j = 0 ; j < K ; j ++ ) sum += digits [ j ] ; for ( int j = 1 ; j < N - K + 1 ; j ++ ) { int curr_sum = 0 ; for ( int m = j ; m < j + K ; m ++ ) curr_sum += digits [ m ] ; if ( sum != curr_sum ) { flag = 1 ; break ; } } if ( flag == 0 ) { count ++ ; } } return count ; } int main ( ) { int N = 2 , K = 1 ; printf ( " % d " , countDigitSum ( N , K ) ) ; return 0 ; }

Index/key variables: N, j, m
Accumulator variables: count, curr_sum, i, j, m, num, sum
Iterator variables: i, j, m
C program:
#include <stdio.h>
#include <string.h>
void convert ( char s [ ] ) { int num = 0 ; int n = strlen ( s ) ; for ( int i = 0 ; i < n ; i ++ ) num = num * 10 + ( s [ i ] - 48 ) ; printf ( " % d " , num ) ; } int main ( ) { char s [ ] = "123" ; convert ( s ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C program:
#include <stdio.h>
int maxSumIS ( int arr [ ] , int n ) { int i , j , max = 0 ; int msis [ n ] ; for ( i = 0 ; i < n ; i ++ ) msis [ i ] = arr [ i ] ; for ( i = 1 ; i < n ; i ++ ) for ( j = 0 ; j < i ; j ++ ) if ( arr [ i ] > arr [ j ] && msis [ i ] < msis [ j ] + arr [ i ] ) msis [ i ] = msis [ j ] + arr [ i ] ; for ( i = 0 ; i < n ; i ++ ) if ( max < msis [ i ] ) max = msis [ i ] ; return max ; } int main ( ) { int arr [ ] = { 1 , 101 , 2 , 3 , 100 , 4 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; printf ( " Sum ▁ of ▁ maximum ▁ sum ▁ increasing ▁ " " subsequence ▁ is ▁ % d STRNEWLINE " , maxSumIS ( arr , n ) ) ; return 0 ; }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
C program:
#include <stdio.h>
#include <stdlib.h>
int _lis ( int arr [ ] , int n , int * max_ref ) { if ( n == 1 ) return 1 ; int res , max_ending_here = 1 ; for ( int i = 1 ; i < n ; i ++ ) { res = _lis ( arr , i , max_ref ) ; if ( arr [ i - 1 ] < arr [ n - 1 ] && res + 1 > max_ending_here ) max_ending_here = res + 1 ; } if ( * max_ref < max_ending_here ) * max_ref = max_ending_here ; return max_ending_here ; } int lis ( int arr [ ] , int n ) { int max = 1 ; _lis ( arr , n , & max ) ; return max ; } int main ( ) { int arr [ ] = { 10 , 22 , 9 , 33 , 21 , 50 , 41 , 60 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; printf ( " Length ▁ of ▁ lis ▁ is ▁ % d STRNEWLINE " , lis ( arr , n ) ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C program:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define ARRAY_SIZE ( a )  (sizeof(a) / sizeof(*a))
int internalSearch ( char * needle , int row , int col , char * * hay , int row_max , int col_max ) { int found = 0 ; if ( row >= 0 && row <= row_max && col >= 0 && col <= col_max && * needle == hay [ row ] [ col ] ) { char match = * needle ++ ; hay [ row ] [ col ] = 0 ; if ( * needle == 0 ) { found = 1 ; } else { found += internalSearch ( needle , row , col + 1 , hay , row_max , col_max ) ; found += internalSearch ( needle , row , col - 1 , hay , row_max , col_max ) ; found += internalSearch ( needle , row + 1 , col , hay , row_max , col_max ) ; found += internalSearch ( needle , row - 1 , col , hay , row_max , col_max ) ; } hay [ row ] [ col ] = match ; } return found ; } int searchString ( char * needle , int row , int col , char * * str , int row_count , int col_count ) { int found = 0 ; int r , c ; for ( r = 0 ; r < row_count ; ++ r ) { for ( c = 0 ; c < col_count ; ++ c ) { found += internalSearch ( needle , r , c , str , row_count - 1 , col_count - 1 ) ; } } return found ; } int main ( void ) { char needle [ ] = " MAGIC " ; char * input [ ] = { " BBABBM " , " CBMBBA " , " IBABBG " , " GOZBBI " , " ABBBBC " , " MCIGAM " } ; char * str [ ARRAY_SIZE ( input ) ] ; int i ; for ( i = 0 ; i < ARRAY_SIZE ( input ) ; ++ i ) { str [ i ] = malloc ( strlen ( input [ i ] ) ) ; strcpy ( str [ i ] , input [ i ] ) ; } printf ( " count : ▁ % d STRNEWLINE " , searchString ( needle , 0 , 0 , str , ARRAY_SIZE ( str ) , strlen ( str [ 0 ] ) ) ) ; return 0 ; }

Index/key variables: col, i, row
Accumulator variables: found, needle
Iterator variables: c, i, r
C program:
#include <stdbool.h>
#include <stdio.h>
bool isBalanced ( char exp [ ] ) { bool flag = true ; int count = 0 ; for ( int i = 0 ; exp [ i ] != ' \0' ; i ++ ) { if ( exp [ i ] == ' ( ' ) { count ++ ; } else { count -- ; } if ( count < 0 ) { flag = false ; break ; } } if ( count != 0 ) { flag = false ; } return flag ; } int main ( ) { char exp1 [ ] = " ( ( ( ) ) ) ( ) ( ) " ; if ( isBalanced ( exp1 ) ) printf ( " Balanced ▁ STRNEWLINE " ) ; else printf ( " Not ▁ Balanced ▁ STRNEWLINE " ) ; char exp2 [ ] = " ( ) ) ( ( ( ) ) " ; if ( isBalanced ( exp2 ) ) printf ( " Balanced ▁ STRNEWLINE " ) ; else printf ( " Not ▁ Balanced ▁ STRNEWLINE " ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Boolean variables: flag
C program:
#include <stdio.h>
#define MAX_SIZE  100
void shortestToChar ( char s [ ] , char c , int * res ) { int list [ MAX_SIZE ] ; int len = 0 ; int l = 0 ; while ( s [ len ] != ' \0' ) { if ( s [ len ] == c ) { list [ l ] = len ; l ++ ; } len ++ ; } int p1 , p2 , v1 , v2 ; l = l - 1 ; p1 = 0 ; p2 = l > 0 ? 1 : 0 ; for ( int i = 0 ; i < len ; i ++ ) { v1 = list [ p1 ] ; v2 = list [ p2 ] ; if ( i <= v1 ) { res [ i ] = ( v1 - i ) ; } else if ( i <= v2 ) { if ( i - v1 < v2 - i ) { res [ i ] = ( i - v1 ) ; } else { res [ i ] = ( v2 - i ) ; p1 = p2 ; p2 = p2 < l ? ( p2 + 1 ) : p2 ; } } else { res [ i ] = ( i - v2 ) ; } } } int main ( ) { char s [ ] = " geeksforgeeks " ; char c = ' e ' ; int res [ MAX_SIZE ] ; shortestToChar ( s , c , res ) ; int i = 0 ; while ( s [ i ] != ' \0' ) printf ( " % d ▁ " , res [ i ++ ] ) ; return 0 ; }

Index/key variables: MAX_SIZE, i, l, len, p1, p2
Accumulator variables: i, l, len
Iterator variables: i
C program:
#include <stdio.h>
#include <string.h>
void reverse ( char str [ ] , int start , int end ) { char temp ; while ( start <= end ) { temp = str [ start ] ; str [ start ] = str [ end ] ; str [ end ] = temp ; start ++ ; end -- ; } } void reverseletter ( char str [ ] , int start , int end ) { int wstart , wend ; for ( wstart = wend = start ; wend < end ; wend ++ ) { if ( str [ wend ] == ' ▁ ' ) continue ; while ( str [ wend ] != ' ▁ ' && wend <= end ) wend ++ ; wend -- ; reverse ( str , wstart , wend ) ; } } int main ( ) { char str [ 1000 ] = " Ashish ▁ Yadav ▁ Abhishek ▁ Rajput ▁ Sunil ▁ Pundir " ; reverseletter ( str , 0 , strlen ( str ) - 1 ) ; printf ( " % s " , str ) ; return 0 ; }

Index/key variables: end, start, wend
Accumulator variables: end, start, wend
Iterator variables: wstart
C program:
#include <stdio.h>
char * toggleCase ( char * a ) { for ( int i = 0 ; a [ i ] != ' \0' ; i ++ ) { a [ i ] ^= 32 ; } return a ; } int main ( ) { char str [ ] = " CheRrY " ; printf ( " Toggle ▁ case : ▁ % s STRNEWLINE " , toggleCase ( str ) ) ; printf ( " Original ▁ string : ▁ % s " , toggleCase ( str ) ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C program:
#include <stdio.h>
int ic_strcmp ( char * s1 , char * s2 ) { int i ; for ( i = 0 ; s1 [ i ] && s2 [ i ] ; ++ i ) { if ( s1 [ i ] == s2 [ i ] || ( s1 [ i ] ^ 32 ) == s2 [ i ] ) continue ; else break ; } if ( s1 [ i ] == s2 [ i ] ) return 0 ; if ( ( s1 [ i ] 32 ) < ( s2 [ i ] 32 ) ) return -1 ; return 1 ; } int main ( void ) { printf ( " ret : ▁ % d STRNEWLINE " , ic_strcmp ( " Geeks " , " apple " ) ) ; printf ( " ret : ▁ % d STRNEWLINE " , ic_strcmp ( " " , " ABCD " ) ) ; printf ( " ret : ▁ % d STRNEWLINE " , ic_strcmp ( " ABCD " , " z " ) ) ; printf ( " ret : ▁ % d STRNEWLINE " , ic_strcmp ( " ABCD " , " abcdEghe " ) ) ; printf ( " ret : ▁ % d STRNEWLINE " , ic_strcmp ( " GeeksForGeeks " , " gEEksFORGeEKs " ) ) ; printf ( " ret : ▁ % d STRNEWLINE " , ic_strcmp ( " GeeksForGeeks " , " geeksForGeeks " ) ) ; return 0 ; }

Index/key variables: i
Iterator variables: i
C program:
#include <stdio.h>
int power ( int N , unsigned int D ) { if ( D == 0 ) return 1 ; if ( D % 2 == 0 ) return power ( N , D / 2 ) * power ( N , D / 2 ) ; return N * power ( N , D / 2 ) * power ( N , D / 2 ) ; } int order ( int N ) { int r = 0 ; while ( N ) { r ++ ; N = N / 10 ; } return r ; } int isArmstrong ( int N ) { int D = order ( N ) ; int temp = N , sum = 0 ; while ( temp ) { int Ni = temp % 10 ; sum += power ( Ni , D ) ; temp = temp / 10 ; } if ( sum == N ) return 1 ; else return 0 ; } int main ( ) { int N = 153 ; if ( isArmstrong ( N ) == 1 ) printf ( " True STRNEWLINE " ) ; else printf ( " False STRNEWLINE " ) ; return 0 ; }

Accumulator variables: r, sum
C program:
#include <stdio.h>
void primeInRange ( int L , int R ) { int i , j , flag ; for ( i = L ; i <= R ; i ++ ) { if ( i == 1 i == 0 ) continue ; flag = 1 ; for ( j = 2 ; j <= i / 2 ; ++ j ) { if ( i % j == 0 ) { flag = 0 ; break ; } } if ( flag == 1 ) printf ( " % d ▁ " , i ) ; } } int main ( ) { int L = 1 ; int R = 10 ; primeInRange ( L , R ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i, j
C program:
#include <stdio.h>
int checkDivisibility ( int n , int digit ) { return ( digit != 0 && n % digit == 0 ) ; } int isAllDigitsDivide ( int n ) { int temp = n ; while ( temp > 0 ) { int digit = temp % 10 ; if ( ! ( checkDivisibility ( n , digit ) ) ) return 0 ; temp /= 10 ; } return 1 ; } int isAllDigitsDistinct ( int n ) { int arr [ 10 ] , i , digit ; for ( i = 0 ; i < 10 ; i ++ ) arr [ i ] = 0 ; while ( n > 0 ) { digit = n % 10 ; if ( arr [ digit ] ) return 0 ; arr [ digit ] = 1 ; n = n / 10 ; } return 1 ; } int isLynchBell ( int n ) { return isAllDigitsDivide ( n ) && isAllDigitsDistinct ( n ) ; } int main ( ) { int N = 12 ; if ( isLynchBell ( N ) ) printf ( " Yes " ) ; else printf ( " No " ) ; return 0 ; }

Index/key variables: digit, i
Accumulator variables: i, temp
Iterator variables: i
C program:
#include " stdio . h "
struct InchFeet { int feet ; float inch ; } ; void findSum ( struct InchFeet arr [ ] , int N ) { int feet_sum = 0 ; float inch_sum = 0.0 ; int x ; for ( int i = 0 ; i < N ; i ++ ) { feet_sum += arr [ i ] . feet ; inch_sum += arr [ i ] . inch ; } if ( inch_sum >= 12 ) { x = ( int ) inch_sum ; inch_sum -= x ; inch_sum += x % 12 ; feet_sum += x / 12 ; } printf ( " Feet ▁ Sum : ▁ % d STRNEWLINE " , feet_sum ) ; printf ( " Inch ▁ Sum : ▁ % .2f " , inch_sum ) ; } int main ( ) { struct InchFeet arr [ ] = { { 10 , 3.7 } , { 10 , 5.5 } , { 6 , 8.0 } } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findSum ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: feet_sum, i, inch_sum
Iterator variables: i
Class/struct names: InchFeet
C program:
#include <stdio.h>
float dydx ( float x , float y ) { return ( x + y - 2 ) ; } float rungeKutta ( float x0 , float y0 , float x , float h ) { int n = ( int ) ( ( x - x0 ) / h ) ; float k1 , k2 ; float y = y0 ; for ( int i = 1 ; i <= n ; i ++ ) { k1 = h * dydx ( x0 , y ) ; k2 = h * dydx ( x0 + 0.5 * h , y + 0.5 * k1 ) ; y = y + ( 1.0 / 6.0 ) * ( k1 + 2 * k2 ) ; x0 = x0 + h ; } return y ; } int main ( ) { float x0 = 0 , y = 1 , x = 2 , h = 0.2 ; printf ( " y ( x ) ▁ = ▁ % f " , rungeKutta ( x0 , y , x , h ) ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C program:
#include <stdio.h>
void addAP ( int A [ ] , int Q , int operations [ 2 ] [ 4 ] ) { for ( int j = 0 ; j < 2 ; ++ j ) { int L = operations [ j ] [ 0 ] , R = operations [ j ] [ 1 ] , a = operations [ j ] [ 2 ] , d = operations [ j ] [ 3 ] ; int curr = a ; for ( int i = L - 1 ; i < R ; i ++ ) { A [ i ] += curr ; curr += d ; } } for ( int i = 0 ; i < 4 ; ++ i ) printf ( " % d ▁ " , A [ i ] ) ; } int main ( ) { int A [ ] = { 5 , 4 , 2 , 8 } ; int Q = 2 ; int Query [ 2 ] [ 4 ] = { { 1 , 2 , 1 , 3 } , { 1 , 4 , 4 , 1 } } ; addAP ( A , Q , Query ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: curr, i
Iterator variables: i, j
C program:
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void monteCarlo ( int N , int K ) { double x , y ; double d ; int pCircle = 0 ; int pSquare = 0 ; int i = 0 ; #pragma  omp parallel firstprivate(x, y, d, i) reduction(+ : pCircle, pSquare) num_threads(K)
{ srand48 ( ( int ) time ( NULL ) ) ; for ( i = 0 ; i < N ; i ++ ) { x = ( double ) drand48 ( ) ; y = ( double ) drand48 ( ) ; d = ( ( x * x ) + ( y * y ) ) ; if ( d <= 1 ) { pCircle ++ ; } pSquare ++ ; } } double pi = 4.0 * ( ( double ) pCircle / ( double ) ( pSquare ) ) ; printf ( " Final ▁ Estimation ▁ of ▁ Pi ▁ = ▁ % f STRNEWLINE " , pi ) ; } int main ( ) { int N = 100000 ; int K = 8 ; monteCarlo ( N , K ) ; }

Accumulator variables: i, pCircle, pSquare
Iterator variables: i
C program:
#include <stdio.h>
#include <stdlib.h>
const int N = 5 ; struct Matrix { int * A ; int size ; } ; void Set ( struct Matrix * mat , int i , int j , int x ) { if ( i >= j ) mat -> A [ i * ( i - 1 ) / 2 + j - 1 ] = x ; } int Get ( struct Matrix mat , int i , int j ) { if ( i >= j ) { return mat . A [ i * ( i - 1 ) / 2 + j - 1 ] ; } else { return 0 ; } } void Display ( struct Matrix mat ) { int i , j ; for ( i = 1 ; i <= mat . size ; i ++ ) { for ( j = 1 ; j <= mat . size ; j ++ ) { if ( i >= j ) { printf ( " % d ▁ " , mat . A [ i * ( i - 1 ) / 2 + j - 1 ] ) ; } else { printf ( "0 ▁ " ) ; } } printf ( " STRNEWLINE " ) ; } } struct Matrix createMat ( int Mat [ N ] [ N ] ) { struct Matrix mat ; mat . size = N ; mat . A = ( int * ) malloc ( mat . size * ( mat . size + 1 ) / 2 * sizeof ( int ) ) ; int i , j ; for ( i = 1 ; i <= mat . size ; i ++ ) { for ( j = 1 ; j <= mat . size ; j ++ ) { Set ( & mat , i , j , Mat [ i - 1 ] [ j - 1 ] ) ; } } return mat ; } int main ( ) { int Mat [ 5 ] [ 5 ] = { { 1 , 0 , 0 , 0 , 0 } , { 1 , 2 , 0 , 0 , 0 } , { 1 , 2 , 3 , 0 , 0 } , { 1 , 2 , 3 , 4 , 0 } , { 1 , 2 , 3 , 4 , 5 } } ; struct Matrix mat = createMat ( Mat ) ; Display ( mat ) ; return 0 ; }

Index/key variables: N
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: Matrix
C program:
#include <stdio.h>
void midptellipse ( int rx , int ry , int xc , int yc ) { float dx , dy , d1 , d2 , x , y ; x = 0 ; y = ry ; d1 = ( ry * ry ) - ( rx * rx * ry ) + ( 0.25 * rx * rx ) ; dx = 2 * ry * ry * x ; dy = 2 * rx * rx * y ; while ( dx < dy ) { printf ( " ( % f , ▁ % f ) STRNEWLINE " , x + xc , y + yc ) ; printf ( " ( % f , ▁ % f ) STRNEWLINE " , - x + xc , y + yc ) ; printf ( " ( % f , ▁ % f ) STRNEWLINE " , x + xc , - y + yc ) ; printf ( " ( % f , ▁ % f ) STRNEWLINE " , - x + xc , - y + yc ) ; if ( d1 < 0 ) { x ++ ; dx = dx + ( 2 * ry * ry ) ; d1 = d1 + dx + ( ry * ry ) ; } else { x ++ ; y -- ; dx = dx + ( 2 * ry * ry ) ; dy = dy - ( 2 * rx * rx ) ; d1 = d1 + dx - dy + ( ry * ry ) ; } } d2 = ( ( ry * ry ) * ( ( x + 0.5 ) * ( x + 0.5 ) ) ) + ( ( rx * rx ) * ( ( y - 1 ) * ( y - 1 ) ) ) - ( rx * rx * ry * ry ) ; while ( y >= 0 ) { printf ( " ( % f , ▁ % f ) STRNEWLINE " , x + xc , y + yc ) ; printf ( " ( % f , ▁ % f ) STRNEWLINE " , - x + xc , y + yc ) ; printf ( " ( % f , ▁ % f ) STRNEWLINE " , x + xc , - y + yc ) ; printf ( " ( % f , ▁ % f ) STRNEWLINE " , - x + xc , - y + yc ) ; if ( d2 > 0 ) { y -- ; dy = dy - ( 2 * rx * rx ) ; d2 = d2 + ( rx * rx ) - dy ; } else { y -- ; x ++ ; dx = dx + ( 2 * ry * ry ) ; dy = dy - ( 2 * rx * rx ) ; d2 = d2 + dx - dy + ( rx * rx ) ; } } } int main ( ) { midptellipse ( 10 , 15 , 50 , 50 ) ; return 0 ; }

Accumulator variables: x, y
C program:
#include <stdio.h>
void HexToBin ( char * hexdec ) { long int i = 0 ; while ( hexdec [ i ] ) { switch ( hexdec [ i ] ) { case '0' : printf ( "0000" ) ; break ; case '1' : printf ( "0001" ) ; break ; case '2' : printf ( "0010" ) ; break ; case '3' : printf ( "0011" ) ; break ; case '4' : printf ( "0100" ) ; break ; case '5' : printf ( "0101" ) ; break ; case '6' : printf ( "0110" ) ; break ; case '7' : printf ( "0111" ) ; break ; case '8' : printf ( "1000" ) ; break ; case '9' : printf ( "1001" ) ; break ; case ' A ' : case ' a ' : printf ( "1010" ) ; break ; case ' B ' : case ' b ' : printf ( "1011" ) ; break ; case ' C ' : case ' c ' : printf ( "1100" ) ; break ; case ' D ' : case ' d ' : printf ( "1101" ) ; break ; case ' E ' : case ' e ' : printf ( "1110" ) ; break ; case ' F ' : case ' f ' : printf ( "1111" ) ; break ; default : printf ( " Invalid hexadecimal digit % c " , hexdec [ i ] ) ; } i ++ ; } } int main ( ) { char hexdec [ 100 ] = "1AC5" ; printf ( " Equivalent Binary value is : " HexToBin ( hexdec ) ; }

Index/key variables: i
Accumulator variables: i
C program:
#include <stdio.h>
int main ( ) { int matrix [ 5 ] [ 5 ] , row_index , column_index , x = 0 , size = 5 ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { matrix [ row_index ] [ column_index ] = ++ x ; } } printf ( " The ▁ matrix ▁ is STRNEWLINE " ) ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { printf ( " % d TABSYMBOL " , matrix [ row_index ] [ column_index ] ) ; } printf ( " STRNEWLINE " ) ; } printf ( " Elements on Secondary diagonal : " for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { if ( ( row_index + column_index ) == size - 1 ) printf ( " % d , ▁ " , matrix [ row_index ] [ column_index ] ) ; } } return 0 ; }

Index/key variables: column_index, row_index
Accumulator variables: column_index, row_index
Iterator variables: column_index, row_index
C program:
#include <stdio.h>
int main ( ) { int matrix [ 5 ] [ 5 ] , row_index , column_index , x = 0 , size = 5 ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { matrix [ row_index ] [ column_index ] = ++ x ; } } printf ( " The ▁ matrix ▁ is STRNEWLINE " ) ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { printf ( " % d TABSYMBOL " , matrix [ row_index ] [ column_index ] ) ; } printf ( " STRNEWLINE " ) ; } printf ( " Elements above Secondary diagonal are : " for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { if ( ( row_index + column_index ) < size - 1 ) printf ( " % d , ▁ " , matrix [ row_index ] [ column_index ] ) ; } } return 0 ; }

Index/key variables: column_index, row_index
Accumulator variables: column_index, row_index
Iterator variables: column_index, row_index
C program:
#include <stdio.h>
int main ( ) { int matrix [ 5 ] [ 5 ] , row_index , column_index , x = 0 , size = 5 ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { matrix [ row_index ] [ column_index ] = ++ x ; } } printf ( " The ▁ matrix ▁ is STRNEWLINE " ) ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { printf ( " % d TABSYMBOL " , matrix [ row_index ] [ column_index ] ) ; } printf ( " STRNEWLINE " ) ; } printf ( " Corner Elements are : " for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { if ( ( row_index == 0 row_index == size - 1 ) && ( column_index == 0 column_index == size - 1 ) ) printf ( " % d , ▁ " , matrix [ row_index ] [ column_index ] ) ; } } return 0 ; }

Index/key variables: column_index, row_index
Accumulator variables: column_index, row_index
Iterator variables: column_index, row_index
C program:
#include <stdio.h>
#include <stdlib.h>
int No_Of_Pairs ( int N ) { int i = 1 ; while ( ( i * i * i ) + ( 2 * i * i ) + i <= N ) i ++ ; return ( i - 1 ) ; } void print_pairs ( int pairs ) { int i = 1 , mul ; for ( i = 1 ; i <= pairs ; i ++ ) { mul = i * ( i + 1 ) ; printf ( " Pair ▁ no . ▁ % d ▁ - - > ▁ ( % d , ▁ % d ) STRNEWLINE " , i , ( mul * i ) , mul * ( i + 1 ) ) ; } } int main ( ) { int N = 500 , pairs , mul , i = 1 ; pairs = No_Of_Pairs ( N ) ; printf ( " No . ▁ of ▁ pairs ▁ = ▁ % d ▁ STRNEWLINE " , pairs ) ; print_pairs ( pairs ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C program:
#include <stdio.h>
#include <string.h>
#define MAX  100
void add ( char v1 [ ] , char v2 [ ] ) { int i , d , c = 0 ; int l1 = strlen ( v1 ) ; int l2 = strlen ( v2 ) ; for ( i = l1 ; i < l2 ; i ++ ) v1 [ i ] = '0' ; for ( i = l2 ; i < l1 ; i ++ ) v2 [ i ] = '0' ; for ( i = 0 ; i < l1 i < l2 ; i ++ ) { d = ( v1 [ i ] - '0' ) + ( v2 [ i ] - '0' ) + c ; c = d / 10 ; d %= 10 ; v1 [ i ] = '0' + d ; } while ( c ) { v1 [ i ] = '0' + ( c % 10 ) ; c /= 10 ; i ++ ; } v1 [ i ] = ' \0' ; v2 [ l2 ] = ' \0' ; } void subs ( char v1 [ ] , char v2 [ ] ) { int i , d , c = 0 ; int l1 = strlen ( v1 ) ; int l2 = strlen ( v2 ) ; for ( i = l2 ; i < l1 ; i ++ ) v2 [ i ] = '0' ; for ( i = 0 ; i < l1 ; i ++ ) { d = ( v1 [ i ] - '0' - c ) - ( v2 [ i ] - '0' ) ; if ( d < 0 ) { d += 10 ; c = 1 ; } else c = 0 ; v1 [ i ] = '0' + d ; } v2 [ l2 ] = ' \0' ; i = l1 - 1 ; while ( i > 0 && v1 [ i ] == '0' ) i -- ; v1 [ i + 1 ] = ' \0' ; } int divi ( char v [ ] , int q ) { int i , l = strlen ( v ) ; int c = 0 , d ; for ( i = l - 1 ; i >= 0 ; i -- ) { d = c * 10 + ( v [ i ] - '0' ) ; c = d % q ; d /= q ; v [ i ] = '0' + d ; } i = l - 1 ; while ( i > 0 && v [ i ] == '0' ) i -- ; v [ i + 1 ] = ' \0' ; return c ; } void rev ( char v [ ] ) { int l = strlen ( v ) ; int i ; char cc ; for ( i = 0 ; i < l - 1 - i ; i ++ ) { cc = v [ i ] ; v [ i ] = v [ l - 1 - i ] ; v [ l - i - 1 ] = cc ; } } void divideWithDiffK ( char a [ ] , char k [ ] ) { rev ( a ) ; rev ( k ) ; add ( a , k ) ; divi ( a , 2 ) ; rev ( a ) ; printf ( " % s ▁ " , a ) ; rev ( a ) ; subs ( a , k ) ; rev ( a ) ; printf ( " % s " , a ) ; } int main ( ) { char a [ MAX ] = "100" , k [ MAX ] = "20" ; divideWithDiffK ( a , k ) ; return 0 ; }

Index/key variables: MAX, i, l2
Accumulator variables: c, d, i
Iterator variables: i
C program:
#include <stdio.h>
float AvgofSquareN ( int n ) { float sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += ( i * i ) ; return sum / n ; } int main ( ) { int n = 2 ; printf ( " % f " , AvgofSquareN ( n ) ) ; return 0 ; }

Accumulator variables: i, sum
Iterator variables: i
C program:
#include <math.h>
#include <stdio.h>
long long maxPrimeFactors ( long long n ) { long long maxPrime = -1 ; while ( n % 2 == 0 ) { maxPrime = 2 ; } while ( n % 3 == 0 ) { maxPrime = 3 ; n = n / 3 ; } for ( int i = 5 ; i <= sqrt ( n ) ; i += 6 ) { while ( n % i == 0 ) { maxPrime = i ; n = n / i ; } while ( n % ( i + 2 ) == 0 ) { maxPrime = i + 2 ; n = n / ( i + 2 ) ; } } if ( n > 4 ) maxPrime = n ; return maxPrime ; } int main ( ) { long long n = 15 ; printf ( " % lld STRNEWLINE " , maxPrimeFactors ( n ) ) ; n = 25698751364526 ; printf ( " % lld " , maxPrimeFactors ( n ) ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C program:
#include <math.h>
#include <stdio.h>
double sum ( int x , int n ) { double i , total = 1.0 , multi = x ; for ( i = 1 ; i <= n ; i ++ ) { total = total + multi / i ; multi = multi * x ; } return total ; } int main ( ) { int x = 2 ; int n = 5 ; printf ( " % .2f " , sum ( x , n ) ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C program:
#include <bits/stdc++.h>
using namespace std ; int lastElement ( vector < int > & arr ) { priority_queue < int > pq ; for ( int i = 0 ; i < arr . size ( ) ; i ++ ) { pq . push ( arr [ i ] ) ; } int m1 , m2 ; while ( ! pq . empty ( ) ) { if ( pq . size ( ) == 1 ) return pq . top ( ) ; m1 = pq . top ( ) ; pq . pop ( ) ; m2 = pq . top ( ) ; pq . pop ( ) ; if ( m1 != m2 ) pq . push ( m1 - m2 ) ; } return 0 ; } int main ( ) { vector < int > arr = { 2 , 7 , 4 , 1 , 8 , 1 , 1 } ; cout << lastElement ( arr ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i