dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { public static boolean isBlumInteger ( int n ) { boolean prime [ ] = new boolean [ 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 ; } public static void main ( String [ ] args ) { int n = 249 ; if ( isBlumInteger ( n ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i, j, q
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
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 ( String [ ] args ) { int n = 5 , r = 3 ; System . out . println ( nCr ( n , r ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . math . * ; import java . text . * ; import java . util . * ; import java . util . regex . * ; class GFG { static int summingSeries ( long n ) { return ( int ) Math . pow ( n , 2 ) ; } public static void main ( String [ ] args ) { int n = 100 ; System . out . println ( " The ▁ sum ▁ of ▁ n ▁ term ▁ is : ▁ " + summingSeries ( n ) ) ; } }

Class/struct names: GFG
Java program:
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 ) System . out . println ( i + " ^ 2 ▁ + ▁ " + j + " ^ 2 ▁ = ▁ " + ab ) ; } } } public static void main ( String [ ] args ) { int a = 1 * 1 + 2 * 2 ; int b = 3 * 3 + 4 * 4 ; System . out . println ( " Representation ▁ of ▁ a ▁ * ▁ b ▁ " + " as ▁ sum ▁ of ▁ 2 ▁ squares : " ) ; find_sum_of_two_squares ( a , b ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int tetrahedralNumber ( int n ) { return ( n * ( n + 1 ) * ( n + 2 ) ) / 6 ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( tetrahedralNumber ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; 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 ) { System . out . print ( " i ▁ = ▁ " + i + "NEW_LINE"); System . out . print ( " j ▁ = ▁ " + j + "NEW_LINE"); System . out . print ( " k ▁ = ▁ " + k + "NEW_LINE"); System . out . print ( " l ▁ = ▁ " + l + "NEW_LINE"); System . out . print ( " Product ▁ of ▁ " + a + " ▁ and ▁ " + b ) ; System . out . print ( " ▁ can ▁ be ▁ written " + " ▁ as ▁ sum ▁ of ▁ squares ▁ of ▁ i , ▁ " + "j, k, lNEW_LINE"); System . out . print ( ab + " ▁ = ▁ " ) ; System . out . print ( i + " * " + i + " ▁ + ▁ " ) ; System . out . print ( j + " * " + j + " ▁ + ▁ " ) ; System . out . print ( k + " * " + k + " ▁ + ▁ " ) ; System . out . print ( l + " * " + l + "NEW_LINE"); System . out . println ( ) ; } } } } } } public static void main ( String [ ] args ) { 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
Java program:
import java . lang . * ; class GFG { public static int calculateDivisors ( int A , int B ) { int N = ( A - B ) ; int noOfDivisors = 0 ; for ( int i = 1 ; i <= Math . sqrt ( N ) ; i ++ ) { if ( ( N % i ) == 0 ) { if ( i > B ) noOfDivisors ++ ; if ( ( N / i ) != i && ( N / i ) > B ) noOfDivisors ++ ; } } return noOfDivisors ; } public 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 ) { System . out . print ( " For ▁ A ▁ = ▁ " + A + " ▁ and ▁ B ▁ = ▁ " + B + " , ▁ X ▁ can ▁ take ▁ Infinitely ▁ many ▁ values " + " ▁ greater ▁ than ▁ " + A + "NEW_LINE"); } else { System . out . print ( " For ▁ A ▁ = ▁ " + A + " ▁ and ▁ B ▁ = ▁ " + B + " , ▁ X ▁ can ▁ take ▁ " + noOfSolutions + " valuesNEW_LINE"); } } public static void main ( String [ ] args ) { 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
Java program:
import java . io . * ; import java . util . * ; 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 . size ( ) + ( long ) Math . sqrt ( n ) ; } public static void main ( String args [ ] ) { System . out . print ( powerNumbers ( 50 ) ) ; } }

Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; 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 ) ; } public static void main ( String [ ] args ) { 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 ) ; System . out . println ( " Mean : ▁ " + m ) ; System . out . println ( " Variance : ▁ " + var ) ; System . out . println ( " Deviation : ▁ " + ( int ) dev ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; import java . math . * ; class GFG { static int sumofseries ( int n ) { return ( n * ( n + 1 ) * ( n + 2 ) * ( n + 3 ) / 4 ) ; } public static void main ( String [ ] args ) { System . out . println ( sumofseries ( 3 ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean isValid ( long i , long m ) { long sq_i = ( long ) Math . sqrt ( i ) ; long sq = Math . min ( m , sq_i ) ; for ( long j = 2 ; j <= sq ; j ++ ) if ( i % j == 0 ) return false ; return true ; } static void findLargestNum ( long n , long m ) { for ( long i = n ; i > m ; i -- ) { if ( isValid ( i , m ) ) { System . out . println ( i ) ; return ; } } System . out . println ( " Number ▁ Doesn ' t ▁ Exists " ) ; } public static void main ( String [ ] args ) { long n = 16 , m = 3 ; findLargestNum ( n , m ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static boolean isPerfectSquare ( int x ) { if ( x >= 0 ) { int sr = ( int ) Math . sqrt ( x ) ; return ( ( sr * sr ) == x ) ; } return false ; } public static void main ( String [ ] args ) { int x = 2502 ; if ( isPerfectSquare ( x ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void printGP ( int a , int r , int n ) { int curr_term ; for ( int i = 0 ; i < n ; i ++ ) { curr_term = a * ( int ) Math . pow ( r , i ) ; System . out . print ( curr_term + " ▁ " ) ; } } public static void main ( String [ ] args ) { int a = 2 ; int r = 3 ; int n = 5 ; printGP ( a , r , n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int gcd ( int a , int b ) { if ( a % b == 0 ) return b ; else return ( gcd ( b , a % b ) ) ; } static int findHcf ( int [ ] [ ] arr , int size ) { int ans = arr [ 0 ] [ 0 ] ; for ( int i = 1 ; i < size ; i ++ ) ans = gcd ( ans , arr [ i ] [ 0 ] ) ; return ( ans ) ; } static int findLcm ( int [ ] [ ] arr , int size ) { int ans = arr [ 0 ] [ 1 ] ; for ( int i = 1 ; i < size ; i ++ ) ans = ( ( ( arr [ i ] [ 1 ] * ans ) ) / ( gcd ( arr [ i ] [ 1 ] , ans ) ) ) ; return ( ans ) ; } static int [ ] hcfOfFraction ( int [ ] [ ] arr , int size ) { int hcf_of_num = findHcf ( arr , size ) ; int lcm_of_deno = findLcm ( arr , size ) ; int [ ] result = new int [ 2 ] ; result [ 0 ] = hcf_of_num ; result [ 1 ] = lcm_of_deno ; for ( int i = result [ 0 ] / 2 ; i > 1 ; i -- ) { if ( ( result [ 1 ] % i == 0 ) && ( result [ 0 ] % i == 0 ) ) { result [ 1 ] /= i ; result [ 0 ] /= i ; } } return ( result ) ; } public static void main ( String [ ] args ) { int size = 4 ; int [ ] [ ] arr = new int [ size ] [ size ] ; for ( int i = 0 ; i < size ; i ++ ) arr [ i ] = new int [ 2 ] ; arr [ 0 ] [ 0 ] = 9 ; arr [ 0 ] [ 1 ] = 10 ; arr [ 1 ] [ 0 ] = 12 ; arr [ 1 ] [ 1 ] = 25 ; arr [ 2 ] [ 0 ] = 18 ; arr [ 2 ] [ 1 ] = 35 ; arr [ 3 ] [ 0 ] = 21 ; arr [ 3 ] [ 1 ] = 40 ; int [ ] result = hcfOfFraction ( arr , size ) ; System . out . println ( result [ 0 ] + " , ▁ " + result [ 1 ] ) ; } }

Index/key variables: i, size
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int getMSB ( int n ) { n |= n >> 1 ; n |= n >> 2 ; n |= n >> 4 ; n |= n >> 8 ; n |= n >> 16 ; return ( ( n + 1 ) >> 2 ) ; } static void multiply ( int F [ ] [ ] , int M [ ] [ ] ) { int x = F [ 0 ] [ 0 ] * M [ 0 ] [ 0 ] + F [ 0 ] [ 1 ] * M [ 1 ] [ 0 ] ; int y = F [ 0 ] [ 0 ] * M [ 0 ] [ 1 ] + F [ 0 ] [ 1 ] * M [ 1 ] [ 1 ] ; int z = F [ 1 ] [ 0 ] * M [ 0 ] [ 0 ] + F [ 1 ] [ 1 ] * M [ 1 ] [ 0 ] ; int w = F [ 1 ] [ 0 ] * M [ 0 ] [ 1 ] + F [ 1 ] [ 1 ] * M [ 1 ] [ 1 ] ; F [ 0 ] [ 0 ] = x ; F [ 0 ] [ 1 ] = y ; F [ 1 ] [ 0 ] = z ; F [ 1 ] [ 1 ] = w ; } static void power ( int F [ ] [ ] , int n ) { if ( n == 0 n == 1 ) return ; int [ ] [ ] M = { { 1 , 1 } , { 1 , 0 } } ; for ( int m = getMSB ( n ) ; m > 0 ; m = m >> 1 ) { multiply ( F , F ) ; if ( ( n & m ) > 0 ) { multiply ( F , M ) ; } } } static int fib ( int n ) { int [ ] [ ] F = { { 1 , 1 } , { 1 , 0 } } ; if ( n == 0 ) return 0 ; power ( F , n - 1 ) ; return F [ 0 ] [ 0 ] ; } public static void main ( String [ ] args ) { int n = 6 ; System . out . println ( fib ( n ) ) ; } }

Accumulator variables: n
Iterator variables: m
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static void SternSequenceFunc ( Vector < Integer > BrocotSequence , int n ) { for ( int i = 1 ; BrocotSequence . size ( ) < n ; i ++ ) { int considered_element = BrocotSequence . get ( i ) ; int precedent = BrocotSequence . get ( i - 1 ) ; BrocotSequence . add ( considered_element + precedent ) ; BrocotSequence . add ( considered_element ) ; } for ( int i = 0 ; i < 15 ; ++ i ) System . out . print ( BrocotSequence . get ( i ) + " ▁ " ) ; } public static void main ( String [ ] args ) { int n = 15 ; Vector < Integer > BrocotSequence = new Vector < Integer > ( ) ; BrocotSequence . add ( 1 ) ; BrocotSequence . add ( 1 ) ; SternSequenceFunc ( BrocotSequence , n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . math . * ; class GFG { static boolean isRevDiffDivisible ( int x , int k ) { int n = x ; int m = 0 ; int flag ; while ( x > 0 ) { m = m * 10 + x % 10 ; x /= 10 ; } return ( Math . abs ( n - m ) % k == 0 ) ; } static int countNumbers ( int l , int r , int k ) { int count = 0 ; for ( int i = l ; i <= r ; i ++ ) if ( isRevDiffDivisible ( i , k ) ) ++ count ; return count ; } public static void main ( String args [ ] ) { int l = 35 , r = 45 , k = 5 ; System . out . println ( countNumbers ( l , r , k ) ) ; } }

Accumulator variables: i, x
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int divSum ( int n ) { int result = 0 ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + 1 ) ; } static boolean areAmicable ( int x , int y ) { if ( divSum ( x ) != y ) return false ; return ( divSum ( y ) == x ) ; } public static void main ( String [ ] args ) { int x = 220 , y = 284 ; if ( areAmicable ( x , y ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . math . * ; class GFG { static boolean isPerfectSquare ( int n ) { if ( n < 0 ) return false ; int root = Math . round ( ( int ) ( Math . sqrt ( n ) ) ) ; return n == root * root ; } static void printnonsquare ( int n ) { int count = 0 ; for ( int i = 1 ; count < n ; ++ i ) { if ( ! isPerfectSquare ( i ) ) { System . out . print ( i + " ▁ " ) ; count ++ ; } } } public static void main ( String args [ ] ) { int n = 10 ; printnonsquare ( n ) ; } }

Accumulator variables: count
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . math . * ; class GFG { static int nonsquare ( int n ) { return n + ( int ) ( 0.5 + ( Math . sqrt ( n ) ) ) ; } static void printNonSquare ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( nonsquare ( i ) + " ▁ " ) ; } public static void main ( String args [ ] ) { int n = 10 ; printNonSquare ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . ArrayList ; import java . util . List ; public class Ludic { public static List < Integer > getLudic ( int n ) { List < Integer > ludics = new ArrayList < Integer > ( n ) ; for ( int i = 1 ; i <= n ; i ++ ) ludics . add ( i ) ; for ( int index = 1 ; index < ludics . size ( ) ; index ++ ) { int first_ludic = ludics . get ( index ) ; int remove_index = index + first_ludic ; while ( remove_index < ludics . size ( ) ) { ludics . remove ( remove_index ) ; remove_index = remove_index + first_ludic - 1 ; } } return ludics ; } public static void main ( String [ ] srgs ) { int n = 25 ; System . out . println ( getLudic ( n ) ) ; } }

Accumulator variables: i, index
Iterator variables: i, index
Class/struct names: Ludic
Java program:
import java . io . * ; import java . util . * ; class GFG { static void sieve ( int n , boolean prime [ ] ) { for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = false ; } } } static void printPrimeTriplets ( int n ) { boolean prime [ ] = new boolean [ n + 1 ] ; Arrays . fill ( prime , true ) ; sieve ( n , prime ) ; System . out . println ( " The ▁ prime ▁ triplets " + " ▁ from ▁ 1 ▁ to ▁ " + n + " are ▁ : " ) ; for ( int i = 2 ; i <= n - 6 ; ++ i ) { if ( prime [ i ] && prime [ i + 2 ] && prime [ i + 6 ] ) System . out . println ( i + " ▁ " + ( i + 2 ) + " ▁ " + ( i + 6 ) ) ; else if ( prime [ i ] && prime [ i + 4 ] && prime [ i + 6 ] ) System . out . println ( i + " ▁ " + ( i + 4 ) + " ▁ " + ( i + 6 ) ) ; } } public static void main ( String args [ ] ) { int n = 25 ; printPrimeTriplets ( n ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class Fraction { int num , den ; Fraction ( int n , int d ) { num = n ; den = d ; } static Fraction maxFraction ( Fraction first , Fraction sec ) { int a = first . num ; int b = first . den ; int c = sec . num ; int d = sec . den ; int Y = a * d - b * c ; return ( Y > 0 ) ? first : sec ; } public static void main ( String [ ] args ) { Fraction first = new Fraction ( 3 , 2 ) ; Fraction sec = new Fraction ( 3 , 4 ) ; Fraction res = maxFraction ( first , sec ) ; System . out . println ( res . num + " / " + res . den ) ; } }

Class/struct names: Fraction
Java program:
import java . util . * ; class GFG { static void nearestPerfectSquare ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int sr = ( int ) Math . sqrt ( arr [ i ] ) ; if ( ( sr & 1 ) == ( arr [ i ] & 1 ) ) System . out . print ( ( sr * sr ) + " ▁ " ) ; else { sr ++ ; System . out . print ( ( sr * sr ) + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int arr [ ] = { 6 , 3 , 2 , 15 } ; int N = arr . length ; nearestPerfectSquare ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, sr
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static Boolean isPentagonal ( int N ) { int i = 1 , M ; do { M = ( 3 * i * i - i ) / 2 ; i += 1 ; } while ( M < N ) ; return ( M == N ) ; } public static void main ( String [ ] args ) { int N = 12 ; if ( isPentagonal ( N ) ) System . out . println ( N + " ▁ is ▁ pentagonal ▁ " ) ; else System . out . println ( N + " ▁ is ▁ not ▁ pentagonal " ) ; } }

Accumulator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { static int unitnumber ( int x , int y ) { x = x % 10 ; if ( y != 0 ) y = y % 4 + 4 ; return ( ( ( int ) ( Math . pow ( x , y ) ) ) % 10 ) ; } public static void main ( String [ ] args ) { int x = 133 , y = 5 ; System . out . println ( unitnumber ( x , y ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int aliquotSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i < n ; i ++ ) if ( n % i == 0 ) sum += i ; return sum ; } public static void main ( String args [ ] ) throws IOException { int n = 12 ; System . out . println ( aliquotSum ( n ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; public class GfG { public static String complexNumberMultiply ( String a , String b ) { String x [ ] = a . split ( " \\ + ▁ i " ) ; String y [ ] = b . split ( " \\ + ▁ i " ) ; int a_real = Integer . parseInt ( x [ 0 ] ) ; int a_img = Integer . parseInt ( x [ 1 ] ) ; int b_real = Integer . parseInt ( y [ 0 ] ) ; int b_img = Integer . parseInt ( y [ 1 ] ) ; return ( a_real * b_real - a_img * b_img ) + " + " + ( a_real * b_img + a_img * b_real ) + " i " ; } public static void main ( String argc [ ] ) { String str1 = "1 + 1i " ; String str2 = "1 + 1i " ; System . out . println ( complexNumberMultiply ( str1 , str2 ) ) ; } }

Class/struct names: GfG
Java program:
import java . io . * ; public class GFG { static float AvgofSquareN ( int n ) { return ( float ) ( ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; } static public void main ( String [ ] args ) { int n = 2 ; System . out . println ( AvgofSquareN ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static float func ( float x ) { return ( 1 / ( 1 + x * x ) ) ; } static float calculate ( float lower_limit , float upper_limit , int interval_limit ) { float value ; float interval_size = ( upper_limit - lower_limit ) / interval_limit ; float sum = func ( lower_limit ) + func ( upper_limit ) ; for ( int i = 1 ; i < interval_limit ; i ++ ) { if ( i % 3 == 0 ) sum = sum + 2 * func ( lower_limit + i * interval_size ) ; else sum = sum + 3 * func ( lower_limit + i * interval_size ) ; } return ( 3 * interval_size / 8 ) * sum ; } public static void main ( String [ ] args ) { int interval_limit = 10 ; float lower_limit = 1 ; float upper_limit = 10 ; float integral_res = calculate ( lower_limit , upper_limit , interval_limit ) ; System . out . println ( integral_res ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { public static int maxArea ( int [ ] a ) { int Area = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { for ( int j = i + 1 ; j < a . length ; j ++ ) { Area = Math . max ( Area , Math . min ( a [ i ] , a [ j ] ) * ( j - i ) ) ; } } return Area ; } public static void main ( String [ ] args ) { int a [ ] = { 1 , 5 , 4 , 3 } ; int b [ ] = { 3 , 1 , 2 , 4 , 5 } ; System . out . println ( maxArea ( a ) ) ; System . out . println ( maxArea ( b ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float focal_length ( float image_distance , float object_distance ) { return 1 / ( ( 1 / image_distance ) + ( 1 / object_distance ) ) ; } public static void main ( String [ ] args ) { float image_distance = 2 ; float object_distance = 50 ; System . out . println ( " Focal ▁ length ▁ of ▁ a ▁ lens ▁ is ▁ " + focal_length ( image_distance , object_distance ) + " ▁ units . " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static boolean check ( int n ) { int m = n ; while ( n != 0 ) { int r = n % 10 ; if ( r > 0 ) if ( ( m % r ) != 0 ) return false ; n /= 10 ; } return true ; } static int count ( int l , int r ) { int ans = 0 ; for ( int i = l ; i <= r ; i ++ ) if ( check ( i ) ) ans += 1 ; return ans ; } public static void main ( String args [ ] ) { int l = 10 , r = 20 ; System . out . println ( count ( 10 , 20 ) ) ; } }

Accumulator variables: ans, i, n
Iterator variables: i
Class/struct names: GFG
Java program:
class demo { public static double sumOfTheSeries ( int n ) { double sum = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += 1.0 / ( i * ( i + 1 ) ) ; return sum ; } public static void main ( String args [ ] ) { int n = 10 ; System . out . println ( sumOfTheSeries ( n ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: demo
Java program:
import java . util . * ; class GFG { static long sum ( long n ) { long root = ( long ) Math . sqrt ( n ) ; long ans = 0 ; for ( int i = 1 ; i <= root ; i ++ ) ans += n / i ; ans = 2 * ans - ( root * root ) ; return ans ; } public static void main ( String [ ] args ) { long n = 35 ; System . out . println ( sum ( n ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int sumOfTheSeries ( int n ) { int sum_n = ( n * ( n + 1 ) / 2 ) ; int sum_sq_n = ( n * ( n + 1 ) / 2 ) * ( 2 * n + 1 ) / 3 ; return ( sum_n + sum_sq_n ) ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . printf ( " Sum ▁ = ▁ % d " , sumOfTheSeries ( n ) ) ; } }

Class/struct names: GFG
Java program:
import static java . lang . Math . * ; class GFG { static int sumofsquare ( int n ) { int [ ] [ ] C = new int [ n + 1 ] [ n + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= min ( i , n ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } int sum = 0 ; for ( i = 0 ; i <= n ; i ++ ) sum += ( C [ n ] [ i ] * C [ n ] [ i ] ) ; return sum ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( sumofsquare ( n ) ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
Java program:
public class GfG { static int sumOfSeries ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) for ( int j = 1 ; j <= i ; j ++ ) sum = sum + i ; return sum ; } public static void main ( String s [ ] ) { int n = 10 ; System . out . println ( sumOfSeries ( n ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG