dhyuti-n/xlcost-variable-roles huggingface dataset:
Java program:
class GFG { static int sigma ( int n ) { if ( n == 1 ) return 1 ; 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 + n + 1 ) ; } static boolean isSuperabundant ( int N ) { for ( double i = 1 ; i < N ; i ++ ) { double x = sigma ( ( int ) ( i ) ) / i ; double y = sigma ( ( int ) ( N ) ) / ( N * 1.0 ) ; if ( x > y ) return false ; } return true ; } public static void main ( String [ ] args ) { int N = 4 ; if ( isSuperabundant ( N ) ) System . out . print ( "YesNEW_LINE"); else System . out . print ( "NoNEW_LINE"); } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isDNum ( int n ) { if ( n < 4 ) return false ; int numerator = 0 , hcf = 0 ; for ( int k = 2 ; k <= n ; k ++ ) { numerator = ( int ) ( Math . pow ( k , n - 2 ) - k ) ; hcf = __gcd ( n , k ) ; } if ( hcf == 1 && ( numerator % n ) != 0 ) return false ; return true ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void main ( String [ ] args ) { int n = 15 ; boolean a = isDNum ( n ) ; if ( a ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }

Accumulator variables: k
Iterator variables: k
Class/struct names: GFG
Java program:
class GFG { static int Sum ( int N ) { int SumOfPrimeDivisors [ ] = new int [ N + 1 ] ; for ( int i = 2 ; i <= N ; ++ i ) { if ( SumOfPrimeDivisors [ i ] == 1 ) { for ( int j = i ; j <= N ; j += i ) { SumOfPrimeDivisors [ j ] += i ; } } } return SumOfPrimeDivisors [ N ] ; } static boolean RuthAaronNumber ( int n ) { if ( Sum ( n ) == Sum ( n + 1 ) ) return true ; else return false ; } public static void main ( String [ ] args ) { int N = 714 ; if ( RuthAaronNumber ( N ) ) { System . out . print ( " Yes " ) ; } else { System . out . print ( " No " ) ; } } }

Index/key variables: N, i, j
Accumulator variables: j
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int maxAdjacentDifference ( int N , int K ) { if ( N == 1 ) { return 0 ; } if ( N == 2 ) { return K ; } return 2 * K ; } public static void main ( String [ ] args ) { int N = 6 ; int K = 11 ; System . out . print ( maxAdjacentDifference ( N , K ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static final int mod = 1000000007 ; public static int linearSum ( int n ) { return ( n * ( n + 1 ) / 2 ) % mod ; } public static int rangeSum ( int b , int a ) { return ( linearSum ( b ) - linearSum ( a ) ) % mod ; } public static int totalSum ( int n ) { int result = 0 ; int i = 1 ; while ( true ) { result += rangeSum ( n / i , n / ( i + 1 ) ) * ( i % mod ) % mod ; result %= mod ; if ( i == n ) break ; i = n / ( n / ( i + 1 ) ) ; } return result ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . println ( totalSum ( N ) ) ; N = 12 ; System . out . println ( totalSum ( N ) ) ; } }

Accumulator variables: result
Class/struct names: GFG
Java program:
class GFG { static boolean isDouble ( int num ) { String s = Integer . toString ( num ) ; int l = s . length ( ) ; if ( s . charAt ( 0 ) == s . charAt ( 1 ) ) return false ; if ( l % 2 == 1 ) { s = s + s . charAt ( 1 ) ; l ++ ; } String s1 = s . substring ( 0 , l / 2 ) ; String s2 = s . substring ( l / 2 ) ; return s1 . equals ( s2 ) ; } static boolean isNontrivialUndulant ( int N ) { return N > 100 && isDouble ( N ) ; } public static void main ( String [ ] args ) { int n = 121 ; if ( isNontrivialUndulant ( n ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } }

Accumulator variables: l
Class/struct names: GFG
Java program:
class GFG { static int MegagonNum ( int n ) { return ( 999998 * n * n - 999996 * n ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . print ( MegagonNum ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int mod = 1000000007 ; static int productPairs ( int arr [ ] , int n ) { int product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { product *= ( arr [ i ] % mod * arr [ j ] % mod ) % mod ; product = product % mod ; } } return product % mod ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 } ; int n = arr . length ; System . out . print ( productPairs ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, product
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static final int mod = 1000000007 ; static int power ( int x , int y ) { int p = 1000000007 ; int res = 1 ; x = x % p ; while ( y > 0 ) { if ( y % 2 == 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } static int productPairs ( int arr [ ] , int n ) { int product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { product = ( product % mod * ( int ) power ( arr [ i ] , ( 2 * n ) ) % mod ) % mod ; } return product % mod ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 } ; int n = arr . length ; System . out . print ( productPairs ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void constructArray ( int N ) { int arr [ ] = new int [ N ] ; for ( int i = 1 ; i <= N ; i ++ ) { arr [ i - 1 ] = i ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( arr [ i ] + " , ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 6 ; constructArray ( N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static boolean isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i < n ; i ++ ) if ( n % i == 0 ) return false ; return true ; } static int countSubsequences ( int arr [ ] , int n ) { int totalSubsequence = ( int ) ( Math . pow ( 2 , n ) - 1 ) ; int countPrime = 0 , countOnes = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 1 ) countOnes ++ ; else if ( isPrime ( arr [ i ] ) ) countPrime ++ ; } int compositeSubsequence ; int onesSequence = ( int ) ( Math . pow ( 2 , countOnes ) - 1 ) ; compositeSubsequence = totalSubsequence - countPrime - onesSequence - onesSequence * countPrime ; return compositeSubsequence ; } public static void main ( String [ ] args ) { int arr [ ] = { 2 , 1 , 2 } ; int n = arr . length ; System . out . print ( countSubsequences ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: countOnes, countPrime, i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void checksum ( int n , int k ) { float first_term = ( float ) ( ( ( 2 * n ) / k + ( 1 - k ) ) / 2.0 ) ; if ( first_term - ( int ) ( first_term ) == 0 ) { for ( int i = ( int ) first_term ; i <= first_term + k - 1 ; i ++ ) { System . out . print ( i + " ▁ " ) ; } } else System . out . print ( " - 1" ) ; } public static void main ( String [ ] args ) { int n = 33 , k = 6 ; checksum ( n , k ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void sumEvenNumbers ( int N , int K ) { int check = N - 2 * ( K - 1 ) ; if ( check > 0 && check % 2 == 0 ) { for ( int i = 0 ; i < K - 1 ; i ++ ) { System . out . print ( "2 ▁ " ) ; } System . out . println ( check ) ; } else { System . out . println ( " - 1" ) ; } } public static void main ( String args [ ] ) { int N = 8 ; int K = 2 ; sumEvenNumbers ( N , K ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . Scanner ; class contiguous_subarrays { public static int [ ] calculateWays ( int n ) { int x = 0 ; int [ ] v = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) v [ i ] = 0 ; for ( int i = 0 ; i < n / 2 ; i ++ ) { if ( n % 2 == 0 && i == n / 2 ) break ; x = n * ( i + 1 ) - ( i + 1 ) * i ; v [ i ] = x ; v [ n - i - 1 ] = x ; } return v ; } public static void printArray ( int [ ] v ) { for ( int i = 0 ; i < v . length ; i ++ ) System . out . print ( v [ i ] + " ▁ " ) ; } public static void main ( String args [ ] ) { int [ ] v ; v = calculateWays ( 4 ) ; printArray ( v ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: contiguous_subarrays
Java program:
class GFG { static final int MAXN = 10000000 ; static int sumOfDigits ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += n % 10 ; n /= 10 ; } return sum ; } static int smallestNum ( int X , int Y ) { int res = - 1 ; for ( int i = X ; i < MAXN ; i ++ ) { int sum_of_digit = sumOfDigits ( i ) ; if ( sum_of_digit % Y == 0 ) { res = i ; break ; } } return res ; } public static void main ( String [ ] args ) { int X = 5923 , Y = 13 ; System . out . print ( smallestNum ( X , Y ) ) ; } }

Accumulator variables: i, n, sum
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int countValues ( int N ) { Vector < Integer > div = new Vector < > ( ) ; for ( int i = 2 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { div . add ( i ) ; if ( N != i * i ) { div . add ( N / i ) ; } } } int answer = 0 ; for ( int i = 1 ; i * i <= N - 1 ; i ++ ) { if ( ( N - 1 ) % i == 0 ) { if ( i * i == N - 1 ) answer ++ ; else answer += 2 ; } } for ( int d : div ) { int K = N ; while ( K % d == 0 ) K /= d ; if ( ( K - 1 ) % d == 0 ) answer ++ ; } return answer ; } public static void main ( String [ ] args ) { int N = 6 ; System . out . print ( countValues ( N ) ) ; } }

Accumulator variables: K, answer, i
Iterator variables: d, i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void findMaxPrimeDivisor ( int n ) { int max_possible_prime = 0 ; while ( n % 2 == 0 ) { max_possible_prime ++ ; n = n / 2 ; } for ( int i = 3 ; i * i <= n ; i = i + 2 ) { while ( n % i == 0 ) { max_possible_prime ++ ; n = n / i ; } } if ( n > 2 ) { max_possible_prime ++ ; } System . out . print ( max_possible_prime + "NEW_LINE"); } public static void main ( String [ ] args ) { int n = 4 ; findMaxPrimeDivisor ( n ) ; } }

Accumulator variables: max_possible_prime
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int CountWays ( int n ) { int ans = ( n - 1 ) / 2 ; return ans ; } public static void main ( String [ ] args ) { int N = 8 ; System . out . print ( CountWays ( N ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void Solve ( int arr [ ] , int size , int n ) { int [ ] v = new int [ n + 1 ] ; for ( int i = 0 ; i < size ; i ++ ) v [ arr [ i ] ] ++ ; int max1 = - 1 , mx = - 1 ; for ( int i = 0 ; i < v . length ; i ++ ) { if ( v [ i ] > mx ) { mx = v [ i ] ; max1 = i ; } } int cnt = 0 ; for ( int i : v ) { if ( i == 0 ) ++ cnt ; } int diff1 = n + 1 - cnt ; int max_size = Math . max ( Math . min ( v [ max1 ] - 1 , diff1 ) , Math . min ( v [ max1 ] , diff1 - 1 ) ) ; System . out . println ( " Maximum ▁ size ▁ is : ▁ " + max_size ) ; System . out . println ( " First ▁ Array ▁ is " ) ; for ( int i = 0 ; i < max_size ; i ++ ) { System . out . print ( max1 + " ▁ " ) ; v [ max1 ] -= 1 ; } System . out . println ( ) ; System . out . println ( " The ▁ Second ▁ Array ▁ Is ▁ : " ) ; for ( int i = 0 ; i < ( n + 1 ) ; i ++ ) { if ( v [ i ] > 0 ) { System . out . print ( i + " ▁ " ) ; max_size -- ; } if ( max_size < 1 ) break ; } System . out . println ( ) ; } public static void main ( String [ ] args ) { int n = 7 ; int arr [ ] = new int [ ] { 1 , 2 , 1 , 5 , 1 , 6 , 7 , 2 } ; int size = arr . length ; Solve ( arr , size , n ) ; } }

Index/key variables: i, max1
Accumulator variables: i, max_size
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static int power ( int x , int y , int p ) { int res = 1 ; x = x % p ; while ( y > 0 ) { if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static int modInverse ( int n , int p ) { return power ( n , p - 2 , p ) ; } static int nCrModPFermat ( int n , int r , int p ) { if ( r == 0 ) return 1 ; if ( n < r ) return 0 ; int fac [ ] = new int [ n + 1 ] ; fac [ 0 ] = 1 ; for ( int i = 1 ; i <= n ; i ++ ) fac [ i ] = fac [ i - 1 ] * i % p ; return ( fac [ n ] * modInverse ( fac [ r ] , p ) % p * modInverse ( fac [ n - r ] , p ) % p ) % p ; } static int SumOfXor ( int a [ ] , int n ) { int mod = 10037 ; int answer = 0 ; for ( int k = 0 ; k < 32 ; k ++ ) { int x = 0 , y = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( a [ i ] & ( 1 << k ) ) != 0 ) x ++ ; else y ++ ; } answer += ( ( 1 << k ) % mod * ( nCrModPFermat ( x , 3 , mod ) + x * nCrModPFermat ( y , 2 , mod ) ) % mod ) % mod ; } return answer ; } public static void main ( String [ ] args ) { int n = 5 ; int A [ ] = { 3 , 5 , 2 , 18 , 7 } ; System . out . println ( SumOfXor ( A , n ) ) ; } }

Index/key variables: i, n, r
Accumulator variables: answer, i, k, x, y
Iterator variables: i, k
Class/struct names: GFG
Java program:
class GFG { public static float round ( float var , int digit ) { float value = ( int ) ( var * Math . pow ( 10 , digit ) + .5 ) ; return ( float ) value / ( float ) Math . pow ( 10 , digit ) ; } public static int probability ( int N ) { int a = 2 ; int b = 3 ; if ( N == 1 ) { return a ; } else if ( N == 2 ) { return b ; } else { for ( int i = 3 ; i <= N ; i ++ ) { int c = a + b ; a = b ; b = c ; } return b ; } } public static float operations ( int N ) { int x = probability ( N ) ; int y = ( int ) Math . pow ( 2 , N ) ; return round ( ( float ) x / ( float ) y , 2 ) ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . println ( ( operations ( N ) ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static boolean isPerfectCube ( int x ) { long cr = Math . round ( Math . cbrt ( x ) ) ; return ( cr * cr * cr == x ) ; } static void checkCube ( int a , int b ) { String s1 = Integer . toString ( a ) ; String s2 = Integer . toString ( b ) ; int c = Integer . parseInt ( s1 + s2 ) ; if ( isPerfectCube ( c ) ) { System . out . println ( " Yes " ) ; } else { System . out . println ( " No " ) ; } } public static void main ( String [ ] args ) { int a = 6 ; int b = 4 ; checkCube ( a , b ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int largest_sum ( int arr [ ] , int n ) { int maximum = - 1 ; HashMap < Integer , Integer > m = new HashMap < Integer , Integer > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( m . containsKey ( arr [ i ] ) ) { m . put ( arr [ i ] , m . get ( arr [ i ] ) + 1 ) ; } else { m . put ( arr [ i ] , 1 ) ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( m . get ( arr [ i ] ) > 1 ) { if ( m . containsKey ( 2 * arr [ i ] ) ) { m . put ( 2 * arr [ i ] , m . get ( 2 * arr [ i ] ) + m . get ( arr [ i ] ) / 2 ) ; } else { m . put ( 2 * arr [ i ] , m . get ( arr [ i ] ) / 2 ) ; } if ( 2 * arr [ i ] > maximum ) maximum = 2 * arr [ i ] ; } } return maximum ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 1 , 2 , 4 , 7 , 8 } ; int n = arr . length ; System . out . println ( largest_sum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void canBeReduced ( int x , int y ) { int maxi = Math . max ( x , y ) ; int mini = Math . min ( x , y ) ; if ( ( ( x + y ) % 3 ) == 0 && maxi <= 2 * mini ) System . out . print ( " YES " + "NEW_LINE"); else System . out . print ( " NO " + "NEW_LINE"); } public static void main ( String [ ] args ) { int x = 6 , y = 9 ; canBeReduced ( x , y ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static void isPrime ( int N ) { boolean isPrime = true ; int [ ] arr = { 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 } ; if ( N < 2 ) { isPrime = false ; } if ( N % 2 == 0 N % 3 == 0 N % 5 == 0 ) { isPrime = false ; } for ( int i = 0 ; i < Math . sqrt ( N ) ; i += 30 ) { for ( int c : arr ) { if ( c > Math . sqrt ( N ) ) { break ; } else { if ( N % ( c + i ) == 0 ) { isPrime = false ; break ; } } if ( ! isPrime ) break ; } } if ( isPrime ) System . out . println ( " Prime ▁ Number " ) ; else System . out . println ( " Not ▁ a ▁ Prime ▁ Number " ) ; } public static void main ( String args [ ] ) { int N = 121 ; isPrime ( N ) ; } }

Accumulator variables: i
Iterator variables: c, i
Boolean variables: isPrime
Class/struct names: GFG
Java program:
class GFG { static void printPairs ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { System . out . print ( " ( " + arr [ i ] + " , ▁ " + arr [ j ] + " ) " + " , ▁ " ) ; } } } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 } ; int n = arr . length ; printPairs ( arr , n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
Java program:
class GFG { static int nearest ( int n ) { int prevCube = ( int ) Math . cbrt ( n ) ; int nextCube = prevCube + 1 ; prevCube = prevCube * prevCube * prevCube ; nextCube = nextCube * nextCube * nextCube ; int ans = ( n - prevCube ) < ( nextCube - n ) ? ( prevCube - n ) : ( nextCube - n ) ; return ans ; } public static void main ( String [ ] args ) { int n = 25 ; System . out . println ( nearest ( n ) ) ; n = 27 ; System . out . println ( nearest ( n ) ) ; n = 40 ; System . out . println ( nearest ( n ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void circle ( int x1 , int y1 , int x2 , int y2 , int r1 , int r2 ) { int distSq = ( int ) Math . sqrt ( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) ) ; if ( distSq + r2 == r1 ) { System . out . println ( " The ▁ smaller ▁ circle ▁ lies ▁ completely " + " ▁ inside ▁ the ▁ bigger ▁ circle ▁ with ▁ " + " touching ▁ each ▁ other ▁ " + " at ▁ a ▁ point ▁ of ▁ circumference . ▁ " ) ; } else if ( distSq + r2 < r1 ) { System . out . println ( " The ▁ smaller ▁ circle ▁ lies ▁ completely " + " ▁ inside ▁ the ▁ bigger ▁ circle ▁ without " + " ▁ touching ▁ each ▁ other ▁ " + " at ▁ a ▁ point ▁ of ▁ circumference . " ) ; } else { System . out . println ( " The ▁ smaller ▁ does ▁ not ▁ lies ▁ inside " + " ▁ the ▁ bigger ▁ circle ▁ completely . " ) ; } } public static void main ( String [ ] args ) { int x1 = 10 , y1 = 8 ; int x2 = 1 , y2 = 2 ; int r1 = 30 , r2 = 10 ; circle ( x1 , y1 , x2 , y2 , r1 , r2 ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void lengtang ( double r1 , double r2 , double d ) { System . out . println ( " The ▁ length ▁ of ▁ the ▁ direct " + " ▁ common ▁ tangent ▁ is ▁ " + ( Math . sqrt ( Math . pow ( d , 2 ) - Math . pow ( ( r1 - r2 ) , 2 ) ) ) ) ; } public static void main ( String [ ] args ) { double r1 = 4 , r2 = 6 , d = 3 ; lengtang ( r1 , r2 , d ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void rad ( double d , double h ) { System . out . println ( " The ▁ radius ▁ of ▁ the ▁ circle ▁ is ▁ " + ( ( d * d ) / ( 8 * h ) + h / 2 ) ) ; } public static void main ( String [ ] args ) { double d = 4 , h = 1 ; rad ( d , h ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void shortdis ( double r , double d ) { System . out . println ( " The ▁ shortest ▁ distance ▁ " + " from ▁ the ▁ chord ▁ to ▁ centre ▁ " + ( Math . sqrt ( ( r * r ) - ( ( d * d ) / 4 ) ) ) ) ; } public static void main ( String [ ] args ) { double r = 4 , d = 3 ; shortdis ( r , d ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void lengtang ( double r1 , double r2 , double d ) { System . out . println ( " The ▁ length ▁ of ▁ the ▁ direct " + " ▁ common ▁ tangent ▁ is ▁ " + ( Math . sqrt ( Math . pow ( d , 2 ) - Math . pow ( ( r1 - r2 ) , 2 ) ) ) ) ; } public static void main ( String [ ] args ) { double r1 = 4 , r2 = 6 , d = 12 ; lengtang ( r1 , r2 , d ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double square ( double a ) { if ( a < 0 ) return - 1 ; double x = 0.464 * a ; return x ; } public static void main ( String [ ] args ) { double a = 5 ; System . out . println ( square ( a ) ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { double polyapothem ( double n , double a ) { if ( a < 0 && n < 0 ) return - 1 ; return ( a / ( 2 * java . lang . Math . tan ( ( 180 / n ) * 3.14159 / 180 ) ) ) ; } public static void main ( String args [ ] ) { double a = 9 , n = 6 ; GFG g = new GFG ( ) ; System . out . println ( g . polyapothem ( n , a ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float polyarea ( float n , float a ) { if ( a < 0 && n < 0 ) return - 1 ; float A = ( a * a * n ) / ( float ) ( 4 * Math . tan ( ( 180 / n ) * 3.14159 / 180 ) ) ; return A ; } public static void main ( String [ ] args ) { float a = 9 , n = 6 ; System . out . println ( polyarea ( n , a ) ) ; } }

Class/struct names: GFG
Java program:
import java . lang . Math ; import java . io . * ; class GFG { static double calculateSide ( double n , double r ) { double theta , theta_in_radians ; theta = 360 / n ; theta_in_radians = theta * 3.14 / 180 ; return 2 * r * Math . sin ( theta_in_radians / 2 ) ; } public static void main ( String [ ] args ) { double n = 3 ; double r = 5 ; System . out . println ( calculateSide ( n , r ) ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float cyl ( float r , float R , float h ) { if ( h < 0 && r < 0 && R < 0 ) return - 1 ; float r1 = r ; float h1 = h ; float V = ( float ) ( 3.14 * Math . pow ( r1 , 2 ) * h1 ) ; return V ; } public static void main ( String [ ] args ) { float r = 7 , R = 11 , h = 6 ; System . out . print ( cyl ( r , R , h ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static double Perimeter ( double s , int n ) { double perimeter = 1 ; perimeter = n * s ; return perimeter ; } public static void main ( String [ ] args ) { int n = 5 ; double s = 2.5 , peri ; peri = Perimeter ( s , n ) ; System . out . println ( " Perimeter ▁ of ▁ Regular ▁ Polygon " + " ▁ with ▁ " + n + " ▁ sides ▁ of ▁ length ▁ " + s + " ▁ = ▁ " + peri ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float rhombusarea ( float l , float b ) { if ( l < 0 b < 0 ) return - 1 ; return ( l * b ) / 2 ; } public static void main ( String [ ] args ) { float l = 16 , b = 6 ; System . out . println ( rhombusarea ( l , b ) ) ; } }

Class/struct names: GFG
Java program:
class GFG { static boolean FindPoint ( int x1 , int y1 , int x2 , int y2 , int x , int y ) { if ( x > x1 && x < x2 && y > y1 && y < y2 ) return true ; return false ; } public static void main ( String [ ] args ) { int x1 = 0 , y1 = 0 , x2 = 10 , y2 = 8 ; int x = 1 , y = 5 ; if ( FindPoint ( x1 , y1 , x2 , y2 , x , y ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static void shortest_distance ( float x1 , float y1 , float z1 , float a , float b , float c , float d ) { d = Math . abs ( ( a * x1 + b * y1 + c * z1 + d ) ) ; float e = ( float ) Math . sqrt ( a * a + b * b + c * c ) ; System . out . println ( " Perpendicular ▁ distance ▁ " + " is ▁ " + d / e ) ; } public static void main ( String [ ] args ) { float x1 = 4 ; float y1 = - 4 ; float z1 = 3 ; float a = 2 ; float b = - 2 ; float c = 5 ; float d = 8 ; shortest_distance ( x1 , y1 , z1 , a , b , c , d ) ; } }

Class/struct names: GFG
Java program:
import java . io . * ; class GFG { static float findVolume ( float l , float b , float h ) { float volume = ( l * b * h ) / 2 ; return volume ; } public static void main ( String [ ] args ) { float l = 18 , b = 12 , h = 9 ; System . out . println ( " Volume ▁ of ▁ triangular ▁ prism : ▁ " + findVolume ( l , b , h ) ) ; } }

Class/struct names: GFG