codeparrot/xlcost-text-to-code huggingface dataset:
Count the number of times graph crosses X | Java implementation to count the number of times the graph crosses the x - axis . ; Function to to count the number of times the graph crosses the x - axis . ; Iterate over the steps array ; Update the previous level and current level by value given in the steps array ; Condition to check that the graph crosses the origin . ; Driver Code
class GFG { static int times ( int [ ] steps , int n ) { int current_level = 0 ; int previous_level = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { previous_level = current_level ; current_level = current_level + steps [ i ] ; if ( ( previous_level < 0 && current_level >= 0 ) || ( previous_level > 0 && current_level <= 0 ) ) { count ++ ; } } return count ; } public static void main ( String [ ] args ) { int steps [ ] = { 1 , - 1 , 0 , 0 , 1 , 1 , - 3 , 2 } ; int n = steps . length ; System . out . println ( times ( steps , n ) ) ; } }
Program to find X , Y and Z intercepts of a plane | Java program to find the X , Y and Z intercepts of a plane ; For finding the x - intercept put y = 0 and z = 0 ; For finding the y - intercept put x = 0 and z = 0 ; For finding the z - intercept put x = 0 and y = 0 ; For Finding value of A , B , C , D ; Calling the first created function ; Driver Code
import java . util . * ; class solution { static double [ ] XandYandZintercept ( double A , double B , double C , double D ) { double [ ] rslt = new double [ 3 ] ; double x = - D / A ; double y = - D / B ; double z = - D / C ; rslt [ 0 ] = x ; rslt [ 1 ] = y ; rslt [ 2 ] = z ; return rslt ; } static void equation_plane ( int [ ] p , int [ ] q , int [ ] r ) { int x1 = p [ 0 ] ; int y1 = p [ 1 ] ; int z1 = p [ 2 ] ; int x2 = q [ 0 ] ; int y2 = q [ 1 ] ; int z2 = q [ 2 ] ; int x3 = r [ 0 ] ; int y3 = r [ 1 ] ; int z3 = r [ 2 ] ; int a1 = x2 - x1 ; int b1 = y2 - y1 ; int c1 = z2 - z1 ; int a2 = x3 - x1 ; int b2 = y3 - y1 ; int c2 = z3 - z1 ; int A = b1 * c2 - b2 * c1 ; int B = a2 * c1 - a1 * c2 ; int C = a1 * b2 - b1 * a2 ; int D = ( - A * x1 - B * y1 - C * z1 ) ; double [ ] rslt = XandYandZintercept ( A , B , C , D ) ; for ( int i = 0 ; i < 3 ; i ++ ) { System . out . printf ( rslt [ i ] + " ▁ " ) ; } } public static void main ( String args [ ] ) { int x1 = - 1 ; int y1 = 2 ; int z1 = 1 ; int x2 = 0 ; int y2 = - 3 ; int z2 = 2 ; int x3 = 1 ; int y3 = 1 ; int z3 = - 4 ; int [ ] p = { x1 , y1 , z1 } ; int [ ] q = { x2 , y2 , z2 } ; int [ ] r = { x3 , y3 , z3 } ; equation_plane ( p , q , r ) ; } }
Percentage change in Hemisphere volume if radius is changed | Java program to find percentage change in hemisphere volume wrt change in radius ; Function to find the change in hemispheric volume ; Driver code ; Get the change in radius ; Calculate the change in hemispheric volume
class GFG { static void new_vol ( double x ) { if ( x > 0 ) { System . out . print ( " % ▁ change ▁ in ▁ the ▁ " + " volume ▁ of ▁ the ▁ hemisphere : ▁ " + ( Math . pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . pow ( x , 2 ) ) / 100 ) + " % " + " increaseNEW_LINE"); } else if ( x < 0 ) { System . out . print ( " % ▁ change ▁ in ▁ the ▁ " + " volume ▁ of ▁ the ▁ hemisphere : ▁ " + ( Math . pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . pow ( x , 2 ) ) / 100 ) + "% decreaseNEW_LINE"); } else { System . out . print ( " Volume ▁ remains ▁ the ▁ same . " ) ; } } public static void main ( String [ ] args ) { double x = - 10.0 ; new_vol ( x ) ; } }
Find the integer points ( x , y ) with Manhattan distance atleast N | Java code to Find the integer points ( x , y ) with Manhattan distance atleast N ; Java function to find all possible point ; Find all 4 corners of the square whose side length is n ; If n is even then the middle point of the square will be an integer , so we will take that point ; Driver Code ; Printing all possible points
import java . util . * ; class GFG { static class pair { int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static Vector < pair > FindPoints ( int n ) { Vector < pair > v = new Vector < pair > ( ) ; v . add ( new pair ( 0 , 0 ) ) ; v . add ( new pair ( 0 , n ) ) ; v . add ( new pair ( n , 0 ) ) ; v . add ( new pair ( n , n ) ) ; if ( n % 2 == 0 ) v . add ( new pair ( n / 2 , n / 2 ) ) ; return v ; } public static void main ( String [ ] args ) { int N = 8 ; Vector < pair > v = FindPoints ( N ) ; for ( pair i : v ) { System . out . print ( " ( " + i . first + " , ▁ " + i . second + " ) ▁ " ) ; } } }
Find if the glass will be empty or not when the rate of drinking is given | Java implementation of the approach ; Function to return the time when the glass will be empty ; Check the condition when the glass will never be empty ; Find the time ; Driver code
class GFG { static double pie = 3.1415926535897 ; static double findsolution ( double d , double h , double m , double n ) { double k = ( 4 * m ) / ( pie * d * d ) ; if ( n > k ) return - 1 ; double ans = ( h / ( k - n ) ) ; return ans ; } public static void main ( String [ ] args ) { double d = 1 , h = 1 , m = 1 , n = 1 ; System . out . printf ( " % .5f " , findsolution ( d , h , m , n ) ) ; } }
Sum of internal angles of a Polygon | Java implementation of the approach ; Function to return the sum of internal angles of an n - sided polygon ; Driver code
class GFG { static int sumOfInternalAngles ( int n ) { if ( n < 3 ) return 0 ; return ( ( n - 2 ) * 180 ) ; } public static void main ( String args [ ] ) { int n = 5 ; System . out . print ( sumOfInternalAngles ( n ) ) ; } }
Number of ways N can be divided into four parts to construct a rectangle | Java implementation of the approach ; Function to return the required number of ways ; Driver code
class GFG { static int cntWays ( int n ) { if ( n % 2 == 1 ) { return 0 ; } else { return ( n - 2 ) / 4 ; } } public static void main ( String [ ] args ) { int n = 18 ; System . out . println ( cntWays ( n ) ) ; } }
Forming triangles using points on a square | Java implementation of the above approach ; Function to return the count of possible triangles ; Driver code
class GFG { static int noOfTriangles ( int n ) { int y = 4 * n ; return ( ( y * ( y - 2 ) * ( y - 1 ) ) - ( 4 * n * ( n - 2 ) * ( n - 1 ) ) ) / 6 ; } public static void main ( String [ ] args ) { int n = 1 ; System . out . println ( noOfTriangles ( n ) ) ; } }
Angle subtended by an arc at the centre of a circle | Java implementation of the approach ; Function to find Angle subtended by an arc at the centre of a circle ; Driver code
import java . io . * ; class GFG { static int angle ( int n ) { return 2 * n ; } public static void main ( String [ ] args ) { int n = 30 ; System . out . println ( angle ( n ) ) ; } }
Check if two given Circles are Orthogonal or not | Java program to check if two circ ; Function to Check if the given circles are orthogonal ; calculating the square of the distance between C1 and C2 ; Check if the given circles are orthogonal ; Driver Code
import java . util . * ; import java . lang . * ; import java . io . * ; class GFG { public static boolean orthogonality ( int x1 , int y1 , int x2 , int y2 , int r1 , int r2 ) { int dsquare = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ; if ( dsquare == r1 * r1 + r2 * r2 ) return true ; else return false ; } public static void main ( String [ ] args ) throws java . lang . Exception { int x1 = 4 , y1 = 3 ; int x2 = 0 , y2 = 1 ; int r1 = 2 , r2 = 4 ; boolean f = orthogonality ( x1 , y1 , x2 , y2 , r1 , r2 ) ; if ( f ) System . out . println ( " Given ▁ circles ▁ are ▁ orthogonal . " ) ; else System . out . println ( " Given ▁ circles ▁ are ▁ not ▁ orthogonal . " ) ; } }
Check if a right | Java implementation of the approach ; Storing all the possible changes to make the triangle right - angled ; Function to check if the triangle is right - angled or not ; Function to check if the triangle can be transformed to right - angled ; Boolean variable to return true or false ; If it is already right - angled ; Applying the changes on the co - ordinates ; Applying on the first co - ordinate ; Applying on the second co - ordinate ; Applying on the third co - ordinate ; If can 't be transformed ; Driver Code
import java . util . * ; class GFG { static int dx [ ] = { - 1 , 0 , 1 , 0 } ; static int dy [ ] = { 0 , 1 , 0 , - 1 } ; static boolean ifRight ( int x1 , int y1 , int x2 , int y2 , int x3 , int y3 ) { int a = ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) ; int b = ( ( x1 - x3 ) * ( x1 - x3 ) ) + ( ( y1 - y3 ) * ( y1 - y3 ) ) ; int c = ( ( x2 - x3 ) * ( x2 - x3 ) ) + ( ( y2 - y3 ) * ( y2 - y3 ) ) ; if ( ( a == ( b + c ) && a != 0 && b != 0 && c != 0 ) || ( b == ( a + c ) && a != 0 && b != 0 && c != 0 ) || ( c == ( a + b ) && a != 0 && b != 0 && c != 0 ) ) { return true ; } return false ; } static void isValidCombination ( int x1 , int y1 , int x2 , int y2 , int x3 , int y3 ) { int x , y ; boolean possible = false ; if ( ifRight ( x1 , y1 , x2 , y2 , x3 , y3 ) ) { System . out . print ( " ALREADY ▁ RIGHT ▁ ANGLED " ) ; return ; } else { for ( int i = 0 ; i < 4 ; i ++ ) { x = dx [ i ] + x1 ; y = dy [ i ] + y1 ; if ( ifRight ( x , y , x2 , y2 , x3 , y3 ) ) { System . out . print ( " POSSIBLE " ) ; return ; } x = dx [ i ] + x2 ; y = dy [ i ] + y2 ; if ( ifRight ( x1 , y1 , x , y , x3 , y3 ) ) { System . out . print ( " POSSIBLE " ) ; return ; } x = dx [ i ] + x3 ; y = dy [ i ] + y3 ; if ( ifRight ( x1 , y1 , x2 , y2 , x , y ) ) { System . out . print ( " POSSIBLE " ) ; return ; } } } if ( ! possible ) System . out . println ( " NOT ▁ POSSIBLE " ) ; } public static void main ( String [ ] args ) { int x1 = - 49 , y1 = 0 ; int x2 = 0 , y2 = 50 ; int x3 = 0 , y3 = - 50 ; isValidCombination ( x1 , y1 , x2 , y2 , x3 , y3 ) ; } }
Program to find Area of Triangle inscribed in N | Java Program to find the area of a triangle inscribed in N - sided regular polygon ; Function to find the area of the polygon ; area of a regular polygon with N sides and side length len ; Function to find the area of a triangle ; area of one triangle in an N - sided regular polygon ; area of inscribed triangle ; Driver code
import java . util . * ; class GFG { static double area_of_regular_polygon ( double n , double len ) { double P = ( len * n ) ; double A = len / ( 2 * Math . tan ( ( 180 / n ) * 3.14159 / 180 ) ) ; double area = ( P * A ) / 2 ; return area ; } static double area_of_triangle_inscribed ( double n , double len ) { double area = area_of_regular_polygon ( n , len ) ; double triangle = area / n ; double ins_tri = ( triangle * 3 ) ; return ins_tri ; } static public void main ( String [ ] arg ) { double n = 6 , len = 10 ; System . out . printf ( " % .3f " , area_of_triangle_inscribed ( n , len ) ) ; } }
Find the area of quadrilateral when diagonal and the perpendiculars to it from opposite vertices are given | Java program to find the area of quadrilateral ; Function to find the area of quadrilateral ; Driver code
class GFG { static float Area ( int d , int h1 , int h2 ) { float area ; area = ( float ) 0.5 * d * ( h1 + h2 ) ; return area ; } public static void main ( String [ ] args ) { int d = 6 , h1 = 4 , h2 = 3 ; System . out . println ( " Area ▁ of ▁ Quadrilateral ▁ = ▁ " + Area ( d , h1 , h2 ) ) ; } }
Find the diagonal of the Cube | Java program to find length of the diagonal of the cube ; Function to find length of diagonal of cube ; Formula to Find length of diagonal of cube ; Driver Code ; Function call
class GFG { static float diagonal_length ( float a ) { float L ; L = a * ( float ) Math . sqrt ( 3 ) ; return L ; } public static void main ( String [ ] args ) { float a = 5 ; System . out . println ( diagonal_length ( a ) ) ; } }
Concentric Hexagonal Numbers | Java program to find nth concentric hexagon number ; Function to find nth concentric hexagon number ; Driver Code ; Function call
class GFG { static int concentric_Haxagon ( int n ) { return 3 * ( int ) Math . pow ( n , 2 ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( concentric_Haxagon ( n ) ) ; } }
Find area of the larger circle when radius of the smaller circle and difference in the area is given | Java implementation of the approach ; Function to return the area of the bigger circle ; Find the radius of the bigger circle ; Calculate the area of the bigger circle ; Driver code
class GFG { static double PI = 3.14 ; static double find_area ( int r , int d ) { double R = d / PI ; R += Math . pow ( r , 2 ) ; R = Math . sqrt ( R ) ; double area = PI * Math . pow ( R , 2 ) ; return area ; } public static void main ( String [ ] args ) { int r = 4 , d = 5 ; System . out . println ( find_area ( r , d ) ) ; } }
Check whether Quadrilateral is valid or not if angles are given | Java program to check if a given quadrilateral is valid or not ; Function to check if a given quadrilateral is valid or not ; Check condition ; Driver code
class GFG { public static int Valid ( int a , int b , int c , int d ) { if ( a + b + c + d == 360 ) return 1 ; return 0 ; } public static void main ( String [ ] args ) { int a = 80 , b = 70 , c = 100 , d = 110 ; if ( Valid ( a , b , c , d ) == 1 ) System . out . println ( " Valid ▁ quadrilateral " ) ; else System . out . println ( " Invalid ▁ quadrilateral " ) ; } }
Central angle of a N sided Regular Polygon | Java program for the above approach ; Function to calculate central angle of a polygon ; Calculate the angle ; Driver code
class GFG { static double calculate_angle ( double n ) { double total_angle = 360 ; return total_angle / n ; } public static void main ( String [ ] args ) { double N = 5 ; System . out . println ( calculate_angle ( N ) ) ; } }
Program to calculate the area of Kite | Java implementation of the approach ; Function to return the area of kite ; Use above formula ; Driver code
class GFG { static float areaOfKite ( int d1 , int d2 ) { float area = ( d1 * d2 ) / 2 ; return area ; } public static void main ( String [ ] args ) { int d1 = 4 , d2 = 6 ; System . out . println ( " Area ▁ of ▁ Kite ▁ = ▁ " + areaOfKite ( d1 , d2 ) ) ; } }
Program to calculate the area of Kite | Java implementation of the approach ; Function to return the area of the kite ; convert angle degree to radians ; use above formula ; Driver code
import java . io . * ; class GFG { static double PI = ( 3.14159 / 180 ) ; static float areaOfKite ( int a , int b , double angle ) { angle = angle * PI ; double area = a * b * Math . sin ( angle ) ; return ( float ) area ; } public static void main ( String [ ] args ) { int a = 4 , b = 7 , angle = 78 ; System . out . println ( " Area ▁ of ▁ Kite ▁ = ▁ " + areaOfKite ( a , b , angle ) ) ; } }
Program to calculate angle on circumference subtended by the chord when the central angle subtended by the chord is given | Java Program to calculate angle on the circumference subtended by the chord when the central angle subtended by the chord is given ; Driver code ; Angle on center
class GFG { static float angleOncirCumference ( float z ) { return ( z / 2 ) ; } public static void main ( String [ ] args ) { float angle = 65 ; float z = angleOncirCumference ( angle ) ; System . out . println ( " The ▁ angle ▁ is ▁ " + z + " ▁ degrees " ) ; } }
Maximum and Minimum value of a quadratic function | Java implementation of the above approach ; Function to print the Maximum and Minimum values of the quadratic function ; Calculate the value of second part ; Print the values ; Open upward parabola function ; Open downward parabola function ; If a = 0 then it is not a quadratic function ; Driver code
import java . util . * ; class GFG { static void PrintMaxMinValue ( double a , double b , double c ) { double secondPart = c * 1.0 - ( b * b / ( 4.0 * a ) ) ; if ( a > 0 ) { System . out . print ( " Maxvalue ▁ = ▁ " + "InfinityNEW_LINE"); System . out . print ( " Minvalue ▁ = ▁ " + secondPart ) ; } else if ( a < 0 ) { System . out . print ( " Maxvalue ▁ = ▁ " + secondPart + "NEW_LINE"); System . out . print ( " Minvalue ▁ = ▁ " + " - Infinity " ) ; } else { System . out . print ( "Not a quadratic functionNEW_LINE"); } } public static void main ( String [ ] args ) { double a = - 1 , b = 3 , c = - 2 ; PrintMaxMinValue ( a , b , c ) ; } }
Percentage increase in the cylinder if the height is increased by given percentage but radius remains constant | Java program to find percentage increase in the cylinder if the height is increased by given percentage but radius remains constant ; Driver code
import java . io . * ; class GFG { static void newvol ( double x ) { System . out . print ( " percentage ▁ increase ▁ " + " in ▁ the ▁ volume ▁ of ▁ the ▁ cylinder ▁ is ▁ " + x + " % " ) ; } public static void main ( String [ ] args ) { double x = 10 ; newvol ( x ) ; } }
Find the side of the squares which are inclined diagonally and lined in a row | Java program to find side of the squares inclined and touch each other externally at vertices and are lined in a row and distance between the centers of first and last squares is given ; Driver code
import java . io . * ; class GFG { static void radius ( double n , double d ) { System . out . print ( " The ▁ side ▁ of ▁ each ▁ square ▁ is ▁ " + d / ( ( n - 1 ) * Math . sqrt ( 2 ) ) ) ; } public static void main ( String [ ] args ) { double d = 42 , n = 4 ; radius ( n , d ) ; } }
Program to calculate area of inner circle which passes through center of outer circle and touches its circumference | Java implementation of the above approach ; Function calculate the area of the inner circle ; the radius cannot be negative ; area of the circle ; Driver Code
class GFG { static double innerCirclearea ( double radius ) { if ( radius < 0 ) { return - 1 ; } double r = radius / 2 ; double Area = ( 3.14 * Math . pow ( r , 2 ) ) ; return Area ; } public static void main ( String arr [ ] ) { double radius = 4 ; System . out . println ( " Area ▁ of ▁ circle ▁ c2 ▁ = ▁ " + innerCirclearea ( radius ) ) ; } }
Angle subtended by the chord when the angle subtended by another chord of same length is given | Java program to find the angle subtended at the center by the chord when the angle subtended at center by another chord of equal length is given ; Driver code
import java . io . * ; class GFG { static void angleequichord ( int z ) { System . out . println ( " The ▁ angle ▁ subtended ▁ at ▁ the ▁ center ▁ is ▁ " + z + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { int z = 48 ; angleequichord ( z ) ; } }
Distance of chord from center when distance between center and another equal length chord is given | Java program to find the distance of chord from center when distance between center and another equal length chord is given / ; Driver code
import java . io . * ; class GFG { static void lengequichord ( int z ) { System . out . println ( " The ▁ distance ▁ between ▁ the ▁ " + " chord ▁ and ▁ the ▁ center ▁ is ▁ " + z ) ; } public static void main ( String [ ] args ) { int z = 48 ; lengequichord ( z ) ; } }
Length of the perpendicular bisector of the line joining the centers of two circles | Java program to find the Length of the perpendicular bisector of the line joining the centers of two circles in which one lies completely inside touching the bigger circle at one point ; Driver code
class GFG { static void lengperpbisect ( double r1 , double r2 ) { double z = 2 * Math . sqrt ( ( r1 * r1 ) - ( ( r1 - r2 ) * ( r1 - r2 ) / 4 ) ) ; System . out . println ( " The ▁ length ▁ of ▁ the ▁ " + " perpendicular ▁ bisector ▁ is ▁ " + z ) ; } public static void main ( String [ ] args ) { double r1 = 5 , r2 = 3 ; lengperpbisect ( r1 , r2 ) ; } }
Length of the chord the circle if length of the another chord which is equally inclined through the diameter is given | Java program to find the length of the chord the circle if length of the another chord which is equally inclined through the diameter is given ; Driver code
import java . io . * ; class GFG { static void lengchord ( int z ) { System . out . println ( " The ▁ length ▁ is ▁ " + z ) ; } public static void main ( String [ ] args ) { int z = 48 ; lengchord ( z ) ; } }
Distance between centers of two intersecting circles if the radii and common chord length is given | Java program to find the distance between centers of two intersecting circles if the radii and common chord length is given ; Driver code
import java . lang . Math ; import java . io . * ; class GFG { static double distcenter ( int r1 , int r2 , int x ) { double z = ( Math . sqrt ( ( r1 * r1 ) - ( x / 2 * x / 2 ) ) ) + ( Math . sqrt ( ( r2 * r2 ) - ( x / 2 * x / 2 ) ) ) ; System . out . println ( " distance ▁ between ▁ the " + " ▁ centers ▁ is ▁ " + ( int ) z ) ; return 0 ; } public static void main ( String [ ] args ) { int r1 = 24 , r2 = 37 , x = 40 ; distcenter ( r1 , r2 , x ) ; } }
Exterior angle of a cyclic quadrilateral when the opposite interior angle is given | Java program to find the exterior angle of a cyclic quadrilateral when the opposite interior angle is given ; Driver code
import java . io . * ; class GFG { static void angleextcycquad ( int z ) { System . out . print ( " The ▁ exterior ▁ angle ▁ of ▁ the " + " ▁ cyclic ▁ quadrilateral ▁ is ▁ " + z + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { int z = 48 ; angleextcycquad ( z ) ; } }
Angle between a chord and a tangent when angle in the alternate segment is given | Java program to find the angle between a chord and a tangent when angle in the alternate segment is given ; Driver code
import java . io . * ; class GFG { static void anglechordtang ( int z ) { System . out . print ( " The ▁ angle ▁ between ▁ tangent " + " ▁ and ▁ the ▁ chord ▁ is ▁ " + z + " ▁ degrees " ) ; } public static void main ( String [ ] args ) { int z = 48 ; anglechordtang ( z ) ; } }
Print all Perfect Numbers from an array whose sum of digits is also a Perfect Number | Java Program to implement the above approach ; Function to check if a number is perfect number or not ; Stores sum of proper divisors ; If sum of digits is equal to N , then it 's a perfect number ; Otherwise , not a perfect number ; Function to find the sum of digits of a number ; Stores sum of digits ; Return sum of digits ; Function to count perfect numbers from an array whose sum of digits is also perfect ; Traverse the array ; If number is perfect ; Stores sum of digits of the number ; If that is also perfect number ; Print that number ; Driver Code ; Given array ; Size of the array ; Function call to count perfect numbers having sum of digits also perfect
import java . io . * ; import java . util . * ; class GFG { static boolean isPerfect ( int N ) { int sumOfDivisors = 1 ; for ( int i = 2 ; i <= N / 2 ; ++ i ) { if ( N % i == 0 ) { sumOfDivisors += i ; } } if ( sumOfDivisors == N ) { return true ; } else return false ; } static int sumOfDigits ( int N ) { int sum = 0 ; while ( N != 0 ) { sum += ( N % 10 ) ; N = N / 10 ; } return sum ; } static void countPerfectNumbers ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; ++ i ) { if ( isPerfect ( arr [ i ] ) ) { int sum = sumOfDigits ( arr [ i ] ) ; if ( isPerfect ( sum ) ) { System . out . print ( arr [ i ] + " ▁ " ) ; } } } } public static void main ( String [ ] args ) { int arr [ ] = { 3 , 8 , 12 , 28 , 6 } ; int N = arr . length ; countPerfectNumbers ( arr , N ) ; } }