dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
import java . util . * ; class GFG { static void maximumFactor ( int [ ] arr ) { int [ ] rank = new int [ Arrays . stream ( arr ) . max ( ) . getAsInt ( ) + 1 ] ; int [ ] factors = new int [ Arrays . stream ( arr ) . max ( ) . getAsInt ( ) + 1 ] ; int g = 0 ; for ( int i = 2 ; i <= Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < arr . length ; j ++ ) if ( arr [ j ] % i == 0 ) count += 1 ; rank [ g ] = count ; factors [ g ] = i ; g ++ ; } int m = Arrays . stream ( rank ) . max ( ) . getAsInt ( ) ; for ( int i = 0 ; i < rank . length ; i ++ ) { if ( rank [ i ] == m ) System . out . print ( factors [ i ] + " ▁ " ) ; } } public static void main ( String [ ] args ) { int [ ] arr = { 120 , 15 , 24 , 63 , 18 } ; maximumFactor ( arr ) ; } }

Index/key variables: g, i, j
Accumulator variables: count, g, i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int findSum ( int n ) { int sum = 0 ; for ( int x = 1 ; x <= n ; x ++ ) sum = sum + x ; return sum ; } public static void main ( String args [ ] ) { int n = 5 ; System . out . println ( findSum ( n ) ) ; } }

Accumulator variables: x
Iterator variables: x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static double findMedian ( int a [ ] , int n ) { Arrays . sort ( a ) ; if ( n % 2 != 0 ) return ( double ) a [ n / 2 ] ; return ( double ) ( a [ ( n - 1 ) / 2 ] + a [ n / 2 ] ) / 2.0 ; } public static void main ( String args [ ] ) { int a [ ] = { 1 , 3 , 4 , 2 , 7 , 5 , 8 , 6 } ; int n = a . length ; System . out . println ( " Median ▁ = ▁ " + findMedian ( a , n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static double findMean ( int a [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += a [ i ] ; return ( double ) sum / ( double ) n ; } public static void main ( String args [ ] ) { int a [ ] = { 1 , 3 , 4 , 2 , 7 , 5 , 8 , 6 } ; int n = a . length ; System . out . println ( " Mean ▁ = ▁ " + findMean ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . ArrayList ; class GFG { static boolean CheckArray ( int arr [ ] , int n ) { int prod = 1 ; ArrayList < Integer > freq = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { freq . add ( arr [ i ] ) ; prod *= arr [ i ] ; } int root = ( int ) Math . sqrt ( prod ) ; if ( root * root == prod ) { if ( freq . contains ( root ) & freq . lastIndexOf ( root ) != ( freq . size ( ) ) ) { return true ; } } return false ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 12 , 3 , 2 } ; int n = arr . length ; if ( CheckArray ( arr , n ) ) { System . out . println ( " YES " ) ; } else { System . out . println ( " NO " ) ; } } }

Index/key variables: i
Accumulator variables: prod
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; class GFG { public static int minAreaRect ( int [ ] [ ] points ) { @ SuppressWarnings ( " unchecked " ) Set < Integer > columns = new HashSet ( ) ; for ( int [ ] point : points ) columns . add ( 40001 * point [ 0 ] + point [ 1 ] ) ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < points . length ; ++ i ) for ( int j = i + 1 ; j < points . length ; ++ j ) { if ( points [ i ] [ 0 ] != points [ j ] [ 0 ] && points [ i ] [ 1 ] != points [ j ] [ 1 ] ) { if ( columns . contains ( 40001 * points [ i ] [ 0 ] + points [ j ] [ 1 ] ) && columns . contains ( 40001 * points [ j ] [ 0 ] + points [ i ] [ 1 ] ) ) { ans = Math . min ( ans , Math . abs ( points [ j ] [ 0 ] - points [ i ] [ 0 ] ) * Math . abs ( points [ j ] [ 1 ] - points [ i ] [ 1 ] ) ) ; } } } return ans < Integer . MAX_VALUE ? ans : 0 ; } public static void main ( String [ ] args ) { int [ ] [ ] A = { { 1 , 1 } , { 1 , 3 } , { 3 , 1 } , { 3 , 3 } , { 2 , 2 } } ; System . out . println ( minAreaRect ( A ) ) ; } }

Index/key variables: i, j
Iterator variables: i, j, point
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int toK ( int N , int K ) { int w = 1 ; int s = 0 ; while ( N != 0 ) { int r = N % K ; N = N / K ; s = r * w + s ; w *= 10 ; } return s ; } static boolean check ( int N ) { boolean fl = false ; while ( N != 0 ) { int r = N % 10 ; N = N / 10 ; if ( fl == true && r == 0 ) return false ; if ( r > 0 ) { fl = false ; continue ; } fl = true ; } return true ; } static void hasConsecutiveZeroes ( int N , int K ) { int z = toK ( N , K ) ; if ( check ( z ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } public static void main ( String [ ] args ) { int N = 15 ; int K = 8 ; hasConsecutiveZeroes ( N , K ) ; } }

Accumulator variables: w
Boolean variables: fl
Class/struct names: GFG
Java program:
public class GFG { static int MAX = 1000000 ; static boolean prime [ ] = new boolean [ MAX + 1 ] ; static void SieveOfEratosthenes ( ) { for ( int i = 0 ; i < prime . length ; i ++ ) { prime [ i ] = true ; } prime [ 1 ] = false ; prime [ 0 ] = false ; for ( int p = 2 ; p * p <= MAX ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= MAX ; i += p ) { prime [ i ] = false ; } } } } static void SumOfKthPrimes ( int arr [ ] , int n , int k ) { int c = 0 ; long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) { c ++ ; if ( c % k == 0 ) { sum += arr [ i ] ; c = 0 ; } } } System . out . println ( sum ) ; } public static void main ( String [ ] args ) { SieveOfEratosthenes ( ) ; int arr [ ] = { 2 , 3 , 5 , 7 , 11 } ; int n = arr . length ; int k = 2 ; SumOfKthPrimes ( arr , n , k ) ; } }

Index/key variables: i, p
Accumulator variables: c, i, p, sum
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static int MAX = 100000 ; static boolean [ ] prime = new boolean [ 100002 ] ; static void SieveOfEratosthenes ( ) { for ( int p = 2 ; p * p <= MAX ; p ++ ) if ( prime [ p ] == false ) for ( int i = p * 2 ; i <= MAX ; i += p ) prime [ i ] = true ; } static int superpower ( int n ) { SieveOfEratosthenes ( ) ; int superPower = 0 , factor = 0 ; int i = 2 ; while ( n > 1 && i <= MAX ) { if ( ! prime [ i ] ) { factor = 0 ; while ( n % i == 0 && n > 1 ) { factor ++ ; n = n / i ; } if ( superPower < factor ) superPower = factor ; } i ++ ; } return superPower ; } public static void main ( String [ ] args ) { int n = 256 ; System . out . println ( superpower ( n ) ) ; } }

Index/key variables: i, p
Accumulator variables: factor, i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
class solution { static class Node { int data ; Node next ; } static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = ( head_ref ) ; ( head_ref ) = new_node ; return head_ref ; } static boolean isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static int countPrime ( Node head_ref ) { int count = 0 ; Node ptr = head_ref ; while ( ptr != null ) { if ( isPrime ( ptr . data ) ) { count ++ ; } ptr = ptr . next ; } return count ; } public static void main ( String args [ ] ) { Node head = null ; head = push ( head , 17 ) ; head = push ( head , 10 ) ; head = push ( head , 6 ) ; head = push ( head , 5 ) ; head = push ( head , 15 ) ; System . out . print ( " Count ▁ of ▁ prime ▁ nodes ▁ = ▁ " + countPrime ( head ) ) ; } }

Accumulator variables: count
Iterator variables: i
Class/struct names: Node, solution
Java program:
import java . io . * ; class GFG { static int smallestDivisor ( int n ) { if ( n % 2 == 0 ) return 2 ; for ( int i = 3 ; i * i <= n ; i += 2 ) { if ( n % i == 0 ) return i ; } return n ; } public static void main ( String [ ] args ) { int n = 31 ; System . out . println ( smallestDivisor ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int countRabbits ( int Heads , int Legs ) { int count = 0 ; count = ( Legs ) - 2 * ( Heads ) ; count = count / 2 ; return count ; } public static void main ( String args [ ] ) { int Heads = 100 , Legs = 300 ; int Rabbits = countRabbits ( Heads , Legs ) ; System . out . println ( " Rabbits ▁ = ▁ " + Rabbits ) ; System . out . println ( " Pigeons ▁ = ▁ " + ( Heads - Rabbits ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class gfg { public static double calculateSum ( double n ) { return 2 * ( Math . pow ( n , 6 ) + 15 * Math . pow ( n , 4 ) + 15 * Math . pow ( n , 2 ) + 1 ) ; } public static void main ( String [ ] args ) { double n = 1.4142 ; System . out . println ( ( int ) Math . ceil ( calculateSum ( n ) ) ) ; } }

Class/struct names: gfg
Java program:
import java . util . * ; class solution { static int Sum_upto_nth_Term ( int n ) { return ( 1 - ( int ) Math . pow ( - 2 , n ) ) ; } public static void main ( String arr [ ] ) { int N = 5 ; System . out . println ( Sum_upto_nth_Term ( N ) ) ; } }

Class/struct names: solution
Java program:
import java . io . * ; import java . util . * ; class GFG { static int xorEqualsOrCount ( int N ) { int count = 0 ; int bit ; while ( N > 0 ) { bit = N % 2 ; if ( bit == 0 ) count ++ ; N = N / 2 ; } return ( int ) Math . pow ( 2 , count ) ; } public static void main ( String args [ ] ) { int N = 7 ; System . out . println ( xorEqualsOrCount ( N ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
Java program:
public class SumOfSeries { static int fact ( int n ) { if ( n == 1 ) return 1 ; return n * fact ( n - 1 ) ; } static double sum ( int x , int n ) { double total = 1.0 ; for ( int i = 1 ; i <= n ; i ++ ) { total = total + ( Math . pow ( x , i ) / fact ( i + 1 ) ) ; } return total ; } public static void main ( String [ ] args ) { int x = 5 , n = 4 ; System . out . print ( " Sum ▁ is : ▁ " + sum ( x , n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: SumOfSeries
Java program:
import java . util . * ; import java . lang . * ; class GFG { static int sum_of_series ( int n ) { int result = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) result = result - ( int ) Math . pow ( i , 2 ) ; else result = result + ( int ) Math . pow ( i , 2 ) ; } return result ; } public static void main ( String args [ ] ) { int n = 3 ; System . out . println ( sum_of_series ( n ) ) ; n = 10 ; System . out . println ( sum_of_series ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int findSum ( int N ) { return ( 2 * N * ( N + 1 ) * ( 4 * N + 17 ) + 54 * N ) / 6 ; } public static void main ( String arr [ ] ) { int N = 4 ; System . out . println ( findSum ( N ) ) ; } }

Class/struct names: solution
Java program:
public class GFG { private static final int MAX = 16 ; static long nCr [ ] [ ] = new long [ MAX ] [ MAX ] ; static void binomial ( ) { for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( j == 0 j == i ) nCr [ i ] [ j ] = 1 ; else nCr [ i ] [ j ] = nCr [ i - 1 ] [ j ] + nCr [ i - 1 ] [ j - 1 ] ; } } } static double findCosNTheta ( double sinTheta , int n ) { double cosTheta = Math . sqrt ( 1 - sinTheta * sinTheta ) ; double ans = 0 ; long toggle = 1 ; for ( int i = 1 ; i <= n ; i += 2 ) { ans = ans + nCr [ n ] [ i ] * Math . pow ( cosTheta , n - i ) * Math . pow ( sinTheta , i ) * toggle ; toggle = toggle * - 1 ; } return ans ; } public static void main ( String args [ ] ) { binomial ( ) ; double sinTheta = 0.5 ; int n = 10 ; System . out . println ( findCosNTheta ( sinTheta , n ) ) ; } }

Index/key variables: MAX, i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int nthTerm ( int N ) { return ( 2 * N + 3 ) * ( 2 * N + 3 ) - 2 * N ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static int MAX = 16 ; static int [ ] [ ] nCr = new int [ MAX ] [ MAX ] ; static void binomial ( ) { for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( j == 0 j == i ) nCr [ i ] [ j ] = 1 ; else nCr [ i ] [ j ] = nCr [ i - 1 ] [ j ] + nCr [ i - 1 ] [ j - 1 ] ; } } } static double findCosnTheta ( double cosTheta , int n ) { double sinTheta = Math . sqrt ( 1 - cosTheta * cosTheta ) ; double ans = 0 ; int toggle = 1 ; for ( int i = 0 ; i <= n ; i += 2 ) { ans = ans + nCr [ n ] [ i ] * Math . pow ( cosTheta , n - i ) * Math . pow ( sinTheta , i ) * toggle ; toggle = toggle * - 1 ; } return ans ; } public static void main ( String [ ] args ) { binomial ( ) ; double cosTheta = 0.5 ; int n = 10 ; System . out . println ( String . format ( " % .5f " , findCosnTheta ( cosTheta , n ) ) ) ; } }

Index/key variables: MAX, i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class solution { static int calculateSum ( int n ) { return ( ( int ) Math . pow ( 10 , n + 1 ) * ( 9 * n - 1 ) + 10 ) / ( int ) Math . pow ( 9 , 3 ) - n * ( n + 1 ) / 18 ; } public static void main ( String ar [ ] ) { int n = 3 ; System . out . println ( " Sum = ▁ " + calculateSum ( n ) ) ; } }

Class/struct names: solution
Java program:
import java . util . * ; class GFG { static int calculateSum ( int n ) { if ( n % 2 == 1 ) return ( n + 1 ) / 2 ; return - n / 2 ; } public static void main ( String ar [ ] ) { int n = 8 ; System . out . println ( calculateSum ( n ) ) ; } }

Class/struct names: GFG
Java program:
public class GFG { static boolean isPower ( int a ) { if ( a == 1 ) return true ; for ( int i = 2 ; i * i <= a ; i ++ ) { double val = Math . log ( a ) / Math . log ( i ) ; if ( ( val - ( int ) val ) < 0.00000001 ) return true ; } return false ; } public static void main ( String [ ] args ) { int n = 16 ; System . out . println ( isPower ( n ) ? " Yes " : " No " ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static float rmsValue ( int arr [ ] , int n ) { int square = 0 ; float mean = 0 ; float root = 0 ; for ( int i = 0 ; i < n ; i ++ ) { square += Math . pow ( arr [ i ] , 2 ) ; } mean = ( square / ( float ) ( n ) ) ; root = ( float ) Math . sqrt ( mean ) ; return root ; } public static void main ( String args [ ] ) { int arr [ ] = { 10 , 4 , 6 , 8 } ; int n = arr . length ; System . out . println ( rmsValue ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, square
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static double Mixture ( int X , int Y , int Z ) { double result1 = 0.0 , result = 0.0 ; result1 = ( ( X - Y ) / ( float ) X ) ; result = Math . pow ( result1 , Z ) ; result = result * X ; return result ; } public static void main ( String [ ] args ) { int X = 10 , Y = 2 , Z = 2 ; System . out . println ( ( float ) Mixture ( X , Y , Z ) + " ▁ litres " ) ; } }

Class/struct names: GFG
Java program:
class Geeks { static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( y != 0 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } static int check ( int n ) { int mod = ( int ) ( 1e9 + 7 ) ; n -- ; int ans = n * n ; if ( ans >= mod ) ans %= mod ; ans += n + 2 ; if ( ans >= mod ) ans %= mod ; ans = ( power ( 2 , n , mod ) % mod * ans % mod ) % mod ; ans = ( ans - 1 + mod ) % mod ; return ans ; } public static void main ( String args [ ] ) { int n = 4 ; System . out . println ( check ( n ) ) ; } }

Accumulator variables: ans, n
Class/struct names: Geeks
Java program:
import java . io . * ; import java . lang . * ; class GfG { public static int findLCM ( int a , int b ) { int lar = Math . max ( a , b ) ; int small = Math . min ( a , b ) ; for ( int i = lar ; ; i += lar ) { if ( i % small == 0 ) return i ; } } public static void main ( String [ ] argc ) { int a = 5 , b = 7 ; System . out . println ( " LCM ▁ of ▁ " + a + " ▁ and ▁ " + b + " ▁ is ▁ " + findLCM ( a , b ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
Java program:
class GFG { static void primes ( int n ) { int i = 2 ; int j = 0 ; int [ ] result = new int [ n ] ; int z = 0 ; while ( j < n ) { boolean flag = true ; for ( int item = 2 ; item <= ( int ) ( i * 1 / 2 ) ; item ++ ) if ( i % item == 0 && i != item ) { flag = false ; break ; } if ( flag ) { result [ z ++ ] = i ; j += 1 ; } i += 1 ; } for ( i = 0 ; i < result . length ; i ++ ) { for ( j = 0 ; j <= i ; j ++ ) System . out . print ( result [ j ] ) ; System . out . print ( " ▁ " ) ; } } static void smar_wln ( int n ) { primes ( n ) ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( " First ▁ " + n + " ▁ terms ▁ of ▁ the ▁ Sequence ▁ are " ) ; smar_wln ( n ) ; } }

Index/key variables: j, n
Accumulator variables: i, item, j, z
Iterator variables: i, item, j
Boolean variables: flag
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int Pentatope_number ( int n ) { return n * ( n + 1 ) * ( n + 2 ) * ( n + 3 ) / 24 ; } public static void main ( String [ ] args ) { int n = 7 ; System . out . println ( n + " th ▁ " + " Pentatope ▁ number ▁ : " + Pentatope_number ( n ) ) ; n = 12 ; System . out . println ( n + " th ▁ " + " Pentatope ▁ number ▁ : " + Pentatope_number ( n ) ) ; } }

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

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int centered_square_num ( int n ) { return n * n + ( ( n - 1 ) * ( n - 1 ) ) ; } public static void main ( String [ ] args ) { int n = 7 ; System . out . print ( n + " th ▁ Centered " + " ▁ square ▁ number : ▁ " + centered_square_num ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int Dodecagonal_number ( int n ) { return 5 * n * n - 4 * n ; } public static void main ( String [ ] args ) { int n = 7 ; System . out . println ( Dodecagonal_number ( n ) ) ; n = 12 ; System . out . println ( Dodecagonal_number ( n ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void SieveOfEratosthenes ( int n , boolean prime [ ] , boolean primesquare [ ] , int a [ ] ) { for ( int i = 2 ; i <= n ; i ++ ) prime [ i ] = true ; for ( int i = 0 ; i <= ( n * n ) ; i ++ ) primesquare [ i ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = false ; } } int j = 0 ; for ( int p = 2 ; p <= n ; p ++ ) { if ( prime [ p ] ) { a [ j ] = p ; primesquare [ p * p ] = true ; j ++ ; } } } static int countDivisors ( int n ) { if ( n == 1 ) return 1 ; boolean prime [ ] = new boolean [ n + 1 ] , primesquare [ ] = new boolean [ n * n + 1 ] ; SieveOfEratosthenes ( n , prime , primesquare , a ) ; int ans = 1 ; for ( int i = 0 ; ; i ++ ) { if ( a [ i ] * a [ i ] * a [ i ] > n ) break ; int cnt = 1 ; while ( n % a [ i ] == 0 ) { n = n / a [ i ] ; } ans = ans * cnt ; } if ( prime [ n ] ) ans = ans * 2 ; else if ( primesquare [ n ] ) ans = ans * 3 ; else if ( n != 1 ) ans = ans * 4 ; } static int sumofFactors ( int n ) { int res = 1 ; for ( int i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { int count = 0 , curr_sum = 1 ; int curr_term = 1 ; while ( n % i == 0 ) { count ++ ; n = n / i ; curr_term *= i ; curr_sum += curr_term ; } res *= curr_sum ; } if ( n >= 2 ) res *= ( 1 + n ) ; return res ; } static boolean checkArithmetic ( int n ) { int count = countDivisors ( n ) ; int sum = sumofFactors ( n ) ; return ( sum % count == 0 ) ; } public static void main ( String [ ] args ) { int n = 6 ; if ( checkArithmetic ( n ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Index/key variables: i, j, n, p
Accumulator variables: count, curr_sum, curr_term, i, j, p, res
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { static int magicOfSequence ( int N ) { return ( N * ( N + 1 ) / 2 ) + 2 * N ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . println ( magicOfSequence ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . util . * ; public class GFG { static List < Integer > power = new ArrayList < Integer > ( ) ; static void nextPower ( Integer N ) { Integer carry = 0 ; for ( int i = 0 ; i < power . size ( ) ; i ++ ) { Integer prod = ( power . get ( i ) * N ) + carry ; power . set ( i , prod % 10 ) ; carry = prod / 10 ; } while ( carry >= 1 ) { power . add ( carry % 10 ) ; carry = carry / 10 ; } } static void printPowerNumber ( int X , int N ) { power . add ( 1 ) ; List < Integer > res = new ArrayList < Integer > ( ) ; for ( int i = 1 ; i <= X ; i ++ ) { nextPower ( N ) ; res . add ( power . get ( power . size ( ) - 1 ) ) ; res . add ( power . get ( 0 ) ) ; } for ( int i = 0 ; i < res . size ( ) ; i ++ ) System . out . print ( res . get ( i ) ) ; } public static void main ( String args [ ] ) { Integer N = 19 , X = 4 ; printPowerNumber ( X , N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int firstDigit ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { fact = fact * i ; while ( fact % 10 == 0 ) fact = fact / 10 ; } while ( fact >= 10 ) fact = fact / 10 ; return fact ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( firstDigit ( n ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . math . * ; class GFG { static int sumofseries ( int n ) { int res = 0 ; for ( int i = 1 ; i <= n ; i ++ ) res += ( i ) * ( i + 1 ) * ( i + 2 ) ; return res ; } public static void main ( String [ ] args ) { System . out . println ( sumofseries ( 3 ) ) ; } }

Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; public class GFG { static void printGMeans ( int A , int B , int N ) { float R = ( float ) Math . pow ( ( float ) ( B / A ) , 1.0 / ( float ) ( N + 1 ) ) ; for ( int i = 1 ; i <= N ; i ++ ) System . out . print ( A * Math . pow ( R , i ) + " ▁ " ) ; } public static void main ( String args [ ] ) { int A = 3 , B = 81 , N = 2 ; printGMeans ( A , B , N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int digitSum ( long n ) { int digSum = 0 ; while ( n > 0 ) { digSum += n % 10 ; n /= 10 ; } return digSum ; } public static long countInteger ( long n , long s ) { if ( n < s ) return 0 ; for ( long i = s ; i <= Math . min ( n , s + 163 ) ; i ++ ) if ( ( i - digitSum ( i ) ) > s ) return ( n - i + 1 ) ; return 0 ; } public static void main ( String args [ ] ) { long n = 1000 , s = 100 ; System . out . println ( countInteger ( n , s ) ) ; } }

Accumulator variables: digSum, i, n
Iterator variables: i
Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static int division ( int num1 , int num2 ) { if ( num1 == 0 ) return 0 ; if ( num2 == 0 ) return Integer . MAX_VALUE ; boolean negResult = false ; if ( num1 < 0 ) { num1 = - num1 ; if ( num2 < 0 ) num2 = - num2 ; else negResult = true ; } else if ( num2 < 0 ) { num2 = - num2 ; negResult = true ; } int quotient = 0 ; while ( num1 >= num2 ) { num1 = num1 - num2 ; quotient ++ ; } if ( negResult ) quotient = - quotient ; return quotient ; } public static void main ( String [ ] args ) { int num1 = 13 , num2 = 2 ; System . out . println ( division ( num1 , num2 ) ) ; } }

Accumulator variables: quotient
Boolean variables: negResult
Class/struct names: GFG