codeparrot/xlcost-text-to-code huggingface dataset:
Distance between orthocenter and circumcenter of a right | C # program for the above approach ; Function to calculate Euclidean distance between the points p1 and p2 ; Stores x coordinates of both points ; Stores y coordinates of both points ; Return the Euclid distance using distance formula ; Function to find orthocenter of the right angled triangle ; Find the length of the three sides ; Orthocenter will be the vertex opposite to the largest side ; Function to find the circumcenter of right angle triangle ; Circumcenter will be located at center of hypotenuse ; If AB is the hypotenuse ; If BC is the hypotenuse ; If AC is the hypotenuse ; Function to find distance between orthocenter and circumcenter ; Find circumcenter ; Find orthocenter ; Find the distance between the orthocenter and circumcenter ; Print distance between orthocenter and circumcenter ; Driver Code ; Given coordinates A , B , and C ; Function Call
using System ; class GFG { public class pair { public double first , second ; public pair ( double first , double second ) { this . first = first ; this . second = second ; } } static double distance ( pair p1 , pair p2 ) { double x1 = p1 . first , x2 = p2 . first ; double y1 = p1 . second , y2 = p2 . second ; return Math . Sqrt ( Math . Pow ( x2 - x1 , 2 ) + Math . Pow ( y2 - y1 , 2 ) * 1.0 ) ; } static pair find_orthocenter ( pair A , pair B , pair C ) { double AB = distance ( A , B ) ; double BC = distance ( B , C ) ; double CA = distance ( C , A ) ; if ( AB > BC && AB > CA ) return C ; if ( BC > AB && BC > CA ) return A ; return B ; } static pair find_circumcenter ( pair A , pair B , pair C ) { double AB = distance ( A , B ) ; double BC = distance ( B , C ) ; double CA = distance ( C , A ) ; if ( AB > BC && AB > CA ) return new pair ( ( A . first + B . first ) / 2 , ( A . second + B . second ) / 2 ) ; if ( BC > AB && BC > CA ) return new pair ( ( B . first + C . first ) / 2 , ( B . second + C . second ) / 2 ) ; return new pair ( ( C . first + A . first ) / 2 , ( C . second + A . second ) / 2 ) ; } static void findDistance ( pair A , pair B , pair C ) { pair circumcenter = find_circumcenter ( A , B , C ) ; pair orthocenter = find_orthocenter ( A , B , C ) ; double distance_between = distance ( circumcenter , orthocenter ) ; Console . Write ( distance_between + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { pair A , B , C ; A = new pair ( 0.0 , 0.0 ) ; B = new pair ( 6.0 , 0.0 ) ; C = new pair ( 0.0 , 8.0 ) ; findDistance ( A , B , C ) ; } }
Generate all integral points lying inside a rectangle | C # program to implement the above approach ; Function to generate coordinates lying within the rectangle ; Store all possible coordinates that lie within the rectangle ; Stores the number of possible coordinates that lie within the rectangle ; For random generator ; Generate all possible coordinates ; Generate all possible X - coordinates ; Generate all possible Y - coordinates ; If coordinates ( X , Y ) has not been generated already ; Insert the coordinates ( X , Y ) ; Print the coordinates ; Driver Code ; Rectangle dimensions
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { public class store : IComparer < KeyValuePair < int , int > > { public int Compare ( KeyValuePair < int , int > x , KeyValuePair < int , int > y ) { if ( x . Key != y . Key ) { return x . Key . CompareTo ( y . Key ) ; } else { return x . Value . CompareTo ( y . Value ) ; } } } static void generatePoints ( int L , int W ) { SortedSet < KeyValuePair < int , int > > hash = new SortedSet < KeyValuePair < int , int > > ( new store ( ) ) ; int total = ( L * W ) ; Random rand = new Random ( ) ; while ( ( total -- ) != 0 ) { int X = rand . Next ( ) % L ; int Y = rand . Next ( ) % W ; while ( hash . Contains ( new KeyValuePair < int , int > ( X , Y ) ) ) { X = rand . Next ( ) % L ; Y = rand . Next ( ) % W ; } hash . Add ( new KeyValuePair < int , int > ( X , Y ) ) ; } foreach ( KeyValuePair < int , int > x in hash ) { Console . Write ( " ( " + x . Key + " , ▁ " + x . Value + " ) ▁ " ) ; } } public static void Main ( string [ ] args ) { int L = 3 , W = 2 ; generatePoints ( L , W ) ; } }
Count triangles required to form a House of Cards of height N | C # implementation of the above approach ; Function to find number of triangles ; Driver Code ; Function call
using System ; class GFG { public static int noOfTriangles ( int n ) { return ( n * ( n + 2 ) * ( 2 * n + 1 ) / 8 ) ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( noOfTriangles ( n ) ) ; } }
Check if N contains all digits as K in base B | C # implementation of above approach ; Function to print the number of digits ; Calculate log using base change property and then take its floor and then add 1 ; Return the output ; Function that returns true if n contains all one 's in base b ; Calculate the sum ; Driver code ; Given number N ; Given base B ; Given digit K ; Function call
using System ; class GFG { static int findNumberOfDigits ( int n , int bas ) { int dig = ( ( int ) Math . Floor ( Math . Log ( n ) / Math . Log ( bas ) ) + 1 ) ; return dig ; } static bool isAllKs ( int n , int b , int k ) { int len = findNumberOfDigits ( n , b ) ; int sum = k * ( 1 - ( int ) Math . Pow ( b , len ) ) / ( 1 - b ) ; return sum == n ; } public static void Main ( ) { int N = 13 ; int B = 3 ; int K = 1 ; if ( isAllKs ( N , B , K ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Check if a right | C # program for the above approach ; Function to check if right - angled triangle can be formed by the given coordinates ; Calculate the sides ; Check Pythagoras Formula ; Driver Code
using System ; class GFG { static void checkRightAngled ( int X1 , int Y1 , int X2 , int Y2 , int X3 , int Y3 ) { int A = ( int ) Math . Pow ( ( X2 - X1 ) , 2 ) + ( int ) Math . Pow ( ( Y2 - Y1 ) , 2 ) ; int B = ( int ) Math . Pow ( ( X3 - X2 ) , 2 ) + ( int ) Math . Pow ( ( Y3 - Y2 ) , 2 ) ; int C = ( int ) Math . Pow ( ( X3 - X1 ) , 2 ) + ( int ) Math . Pow ( ( Y3 - Y1 ) , 2 ) ; if ( ( A > 0 && B > 0 && C > 0 ) && ( A == ( B + C ) || B == ( A + C ) || C == ( A + B ) ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( String [ ] s ) { int X1 = 0 , Y1 = 2 ; int X2 = 0 , Y2 = 14 ; int X3 = 9 , Y3 = 2 ; checkRightAngled ( X1 , Y1 , X2 , Y2 , X3 , Y3 ) ; } }
Count of intersections of M line segments with N vertical lines in XY plane | C # implementation for the above approach . ; Function to create prefix sum array ; Initialize the prefix array to remove garbage values ; Marking the occurences of vertical lines ; x is the value after Index mapping ; Creating the prefix array ; Function returns the count of total intersection ; ans is the number of points of intersection of the line segments with the vertical lines ; Index mapping ; We don 't consider a vertical  line segment because even if  it falls on a verticale line  then it just touches it and  not intersects. ; We have assumed that x1 will be left and x2 right but if not then we just swap them ; Driver code ; N is the number of vertical lines M is the number of line segments ; Format : x1 , y1 , x2 , y1 ; First create the prefix array ; Print the total number of intersections
using System ; class GFG { static void createPrefixArray ( int n , int [ ] arr , int prefSize , int [ ] pref ) { for ( int i = 0 ; i < prefSize ; i ++ ) { pref [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { int x = arr [ i ] + 1000000 ; pref [ x ] ++ ; } for ( int i = 1 ; i < prefSize ; i ++ ) { pref [ i ] += pref [ i - 1 ] ; } } static int pointsOfIntersection ( int m , int [ , ] segments , int size , int [ ] pref ) { int ans = 0 ; for ( int i = 0 ; i < m ; i ++ ) { int x1 = segments [ i , 0 ] ; int x2 = segments [ i , 2 ] ; x1 = x1 + 1000000 ; x2 = x2 + 1000000 ; if ( x1 != x2 ) { if ( x1 > x2 ) { int temp = x1 ; x1 = x2 ; x2 = temp ; } int Occ_Till_Right = pref [ x2 - 1 ] ; int Occ_Till_Left = pref [ x1 ] ; ans = ans + ( Occ_Till_Right - Occ_Till_Left ) ; } } return ans ; } public static void Main ( String [ ] args ) { int N = 4 ; int M = 8 ; int size = 2000000 + 2 ; int [ ] pref = new int [ size ] ; int [ ] lines = { - 5 , - 3 , 2 , 3 } ; int [ , ] segments = { { - 2 , 5 , 5 , - 6 } , { - 5 , - 2 , - 3 , - 5 } , { - 2 , 3 , - 6 , 1 } , { - 1 , - 3 , 4 , 2 } , { 2 , 5 , 2 , 1 } , { 4 , 5 , 4 , - 5 } , { - 2 , - 4 , 5 , 3 } , { 1 , 2 , - 2 , 1 } } ; createPrefixArray ( N , lines , size , pref ) ; Console . Write ( pointsOfIntersection ( M , segments , size , pref ) + " STRNEWLINE " ) ; } }
Count of rectangles possible from N and M straight lines parallel to X and Y axis respectively | C # Program to count number of rectangles formed by N lines parallel to X axis M lines parallel to Y axis ; Function to calculate number of rectangles ; Total number of ways to select two lines parallel to X axis ; Total number of ways to select two lines parallel to Y axis ; Total number of rectangles ; Driver Program
using System ; class GFG { static int count_rectangles ( int N , int M ) { int p_x = ( N * ( N - 1 ) ) / 2 ; int p_y = ( M * ( M - 1 ) ) / 2 ; return p_x * p_y ; } public static void Main ( ) { int N = 3 ; int M = 6 ; Console . Write ( count_rectangles ( N , M ) ) ; } }
Angle between a Pair of Lines in 3D | C # program for the above approach ; Function to find the angle between the two lines ; Find direction ratio of line AB ; Find direction ratio of line BC ; Find the dotProduct of lines AB & BC ; Find magnitude of line AB and BC ; Find the cosine of the angle formed by line AB and BC ; Find angle in radian ; Print the angle ; Driver code ; Given coordinates Points A ; Points B ; Points C ; Function Call
using System ; class GFG { static void calculateAngle ( int x1 , int y1 , int z1 , int x2 , int y2 , int z2 , int x3 , int y3 , int z3 ) { int ABx = x1 - x2 ; int ABy = y1 - y2 ; int ABz = z1 - z2 ; int BCx = x3 - x2 ; int BCy = y3 - y2 ; int BCz = z3 - z2 ; double dotProduct = ABx * BCx + ABy * BCy + ABz * BCz ; double magnitudeAB = ABx * ABx + ABy * ABy + ABz * ABz ; double magnitudeBC = BCx * BCx + BCy * BCy + BCz * BCz ; double angle = dotProduct ; angle /= Math . Sqrt ( magnitudeAB * magnitudeBC ) ; angle = ( angle * 180 ) / 3.14 ; Console . Write ( String . Format ( " { 0 : F4 } " , Math . Abs ( angle ) ) ) ; } public static void Main ( ) { int x1 = 1 , y1 = 3 , z1 = 3 ; int x2 = 3 , y2 = 4 , z2 = 5 ; int x3 = 5 , y3 = 6 , z3 = 9 ; calculateAngle ( x1 , y1 , z1 , x2 , y2 , z2 , x3 , y3 , z3 ) ; } }
Distance between end points of Hour and minute hand at given time | C # implementation to find the distance between the end points of the hour and minute hand ; Function to find the angle between Hour hand and minute hand ; Validate the input ; Calculate the angles moved by hour and minute hands with reference to 12 : 00 ; Find the difference between two angles ; Return the smaller angle of two possible angles ; Function to calculate cos value of angle c ; Converting degrees to radian ; Maps the sum along the series ; Holds the actual value of sin ( n ) ; Function to distance between the endpoints of the hour and minute hand ; Driver code ; Time ; Length of hour hand ; Length of minute hand ; Calling Function for finding angle between hour hand and minute hand ; Function for finding distance between end points of minute hand and hour hand
using System ; class GFG { static int calcAngle ( double h , double m ) { if ( h < 0 m < 0 h > 12 m > 60 ) Console . Write ( " Wrong ▁ input " ) ; if ( h == 12 ) h = 0 ; if ( m == 60 ) m = 0 ; int hour_angle = ( int ) ( 0.5 * ( h * 60 + m ) ) ; int minute_angle = ( int ) ( 6 * m ) ; int angle = Math . Abs ( hour_angle - minute_angle ) ; angle = Math . Min ( 360 - angle , angle ) ; return angle ; } static float cal_cos ( float n ) { float accuracy = ( float ) 0.0001 , x1 , denominator , cosx , cosval ; n = ( float ) ( n * ( 3.142 / 180.0 ) ) ; x1 = 1 ; cosx = x1 ; cosval = ( float ) Math . Cos ( n ) ; int i = 1 ; do { denominator = 2 * i * ( 2 * i - 1 ) ; x1 = - x1 * n * n / denominator ; cosx = cosx + x1 ; i = i + 1 ; } while ( accuracy <= Math . Abs ( cosval - cosx ) ) ; return cosx ; } static float distanceEndpoints ( int a , int b , float c ) { float angle = cal_cos ( c ) ; return ( float ) Math . Sqrt ( ( a * a ) + ( b * b ) - 2 * a * b * angle ) ; } public static void Main ( ) { int hour = 3 ; int min = 30 ; int hourHand = 3 ; int minHand = 4 ; double angle = calcAngle ( hour , min ) ; float distance = distanceEndpoints ( minHand , hourHand , ( long ) angle ) ; Console . Write ( distance ) ; } }
Pentadecagonal Number | C # program to find Nth pentadecagonal number ; Function to find N - th pentadecagonal number ; Formula to calculate nth Pentadecagonal number ; Driver code
using System ; class GFG { static int Pentadecagonal_num ( int n ) { return ( 13 * n * n - 11 * n ) / 2 ; } public static void Main ( string [ ] args ) { int n = 3 ; Console . Write ( Pentadecagonal_num ( n ) + " STRNEWLINE " ) ; n = 10 ; Console . Write ( Pentadecagonal_num ( n ) + " STRNEWLINE " ) ; } }
Octadecagonal Number | C # program to find Nth octadecagonal number ; Function to find N - th octadecagonal number ; Formula to calculate nth octadecagonal number ; Driver code
using System ; class GFG { static int Octadecagonal_num ( int n ) { return ( 16 * n * n - 14 * n ) / 2 ; } public static void Main ( string [ ] args ) { int n = 3 ; Console . Write ( Octadecagonal_num ( n ) + " STRNEWLINE " ) ; n = 10 ; Console . Write ( Octadecagonal_num ( n ) + " STRNEWLINE " ) ; } }
Icositrigonal Number | C # program to find nth Icositrigonal number ; Function to find N - th Icositrigonal number ; Formula to calculate nth Icositrigonal number ; Driver code
using System ; class GFG { static int IcositrigonalNum ( int n ) { return ( 21 * n * n - 19 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . WriteLine ( IcositrigonalNum ( n ) ) ; n = 10 ; Console . WriteLine ( IcositrigonalNum ( n ) ) ; } }
Find the percentage change in the area of a Rectangle | C # implementation to find the percentage ; Function to calculate percentage change in area of rectangle ; Driver Code
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int calculate_change ( int length , int breadth ) { int change = 0 ; change = length + breadth + ( ( length * breadth ) / 100 ) ; return change ; } public static void Main ( String [ ] args ) { int cL = 20 ; int cB = - 10 ; int cA = calculate_change ( cL , cB ) ; Console . Write ( cA ) ; } }
Minimum number of Circular obstacles required to obstruct the path in a Grid | C # program to find the minimum number of obstacles required ; Function to find the minimum number of obstacles required ; Find the minimum range required to put obstacles ; Sorting the radius ; If val is less than zero then we have find the number of obstacles required ; Driver code
using System ; class GFG { static int solve ( int n , int m , int obstacles , double [ ] range ) { double val = Math . Min ( n , m ) ; Array . Sort ( range ) ; int c = 1 ; for ( int i = obstacles - 1 ; i >= 0 ; i -- ) { range [ i ] = 2 * range [ i ] ; val -= range [ i ] ; if ( val <= 0 ) { return c ; } else { c ++ ; } } if ( val > 0 ) { return - 1 ; } return 0 ; } public static void Main ( ) { int n = 4 , m = 5 , obstacles = 3 ; double [ ] range = { 1.0 , 1.25 , 1.15 } ; Console . WriteLine ( solve ( n , m , obstacles , range ) ) ; } }
Program to calculate area of a rhombus whose one side and diagonal are given | C # program to calculate the area of a rhombus whose one side and one diagonal is given ; function to calculate the area of the rhombus ; Second diagonal ; area of rhombus ; return the area ; Driver code
using System ; class GFG { static double area ( double d1 , double a ) { double d2 = Math . Sqrt ( 4 * ( a * a ) - d1 * d1 ) ; double area = 0.5 * d1 * d2 ; return area ; } public static void Main ( String [ ] args ) { double d = 7.07 ; double a = 5 ; Console . WriteLine ( area ( d , a ) ) ; } }
Check whether two points ( x1 , y1 ) and ( x2 , y2 ) lie on same side of a given line or not | C # program to check if two points lie on the same side or not ; Function to check if two points lie on the same side or not ; int fx1 ; Variable to store a * x1 + b * y1 - c int fx2 ; Variable to store a * x2 + b * y2 - c ; If fx1 and fx2 have same sign ; Driver code
using System ; class GFG { static bool pointsAreOnSameSideOfLine ( int a , int b , int c , int x1 , int y1 , int x2 , int y2 ) { fx1 = a * x1 + b * y1 - c ; fx2 = a * x2 + b * y2 - c ; if ( ( fx1 * fx2 ) > 0 ) return true ; return false ; } public static void Main ( ) { int a = 1 , b = 1 , c = 1 ; int x1 = 1 , y1 = 1 ; int x2 = 2 , y2 = 1 ; if ( pointsAreOnSameSideOfLine ( a , b , c , x1 , y1 , x2 , y2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }
Percentage increase in volume of the cube if a side of cube is increased by a given percentage | C # program to find percentage increase in the volume of the cube if a side of cube is increased by a given percentage ; Driver code
using System ; class GFG { static void newvol ( double x ) { Console . Write ( " percentage ▁ increase ▁ " + " in ▁ the ▁ volume ▁ of ▁ the ▁ cube ▁ is ▁ " + ( Math . Pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . Pow ( x , 2 ) ) / 100 ) ) ; Console . Write ( " % " ) ; } public static void Main ( ) { double x = 10 ; newvol ( x ) ; } }
Number of triangles formed by joining vertices of n | C # program to implement the above problem ; Function to find the number of triangles ; print the number of triangles having two side common ; print the number of triangles having no side common ; Driver code ; initialize the number of sides of a polygon
using System ; class GFG { static void findTriangles ( int n ) { int num = n ; Console . Write ( num + " ▁ " ) ; Console . WriteLine ( num * ( num - 4 ) * ( num - 5 ) / 6 ) ; } public static void Main ( ) { int n ; n = 6 ; findTriangles ( n ) ; } }
Find the radii of the circles which are lined in a row , and distance between the centers of first and last circle is given | C # program to find radii of the circles which are lined in a row and distance between the centers of first and last circle is given ; Driver code
using System ; class GFG { static void radius ( int n , int d ) { Console . Write ( " The ▁ radius ▁ of ▁ each ▁ circle ▁ is ▁ " + d / ( 2 * n - 2 ) ) ; } static public void Main ( ) { int d = 42 , n = 4 ; radius ( n , d ) ; } }
Find the side of the squares which are lined in a row , and distance between the centers of first and last square is given | C # program to find side of the squares which are lined in a row and distance between the centers of first and last squares is given ; Driver code
using System ; class GFG { static void radius ( int n , int d ) { Console . Write ( " The ▁ side ▁ of ▁ each ▁ square ▁ is ▁ " + d / ( n - 1 ) ) ; } public static void Main ( ) { int d = 42 , n = 4 ; radius ( n , d ) ; } }
Number of triangles formed by joining vertices of n | C # program to implement the above problem ; Function to find the number of triangles ; print the number of triangles ; Driver code ; initialize the number of sides of a polygon
using System ; class GFG { static void findTriangles ( int n ) { int num ; num = n * ( n - 4 ) ; Console . WriteLine ( num ) ; } public static void Main ( ) { int n ; n = 6 ; findTriangles ( n ) ; } }
Find the Diameter or Longest chord of a Circle | C # program to find the longest chord or diameter of the circle whose radius is given ; Function to find the longest chord ; Driver code ; Get the radius ; Find the diameter
using System ; class GFG { static void diameter ( double r ) { Console . WriteLine ( " The ▁ length ▁ of ▁ the ▁ longest ▁ chord " + " ▁ or ▁ diameter ▁ of ▁ the ▁ circle ▁ is ▁ " + 2 * r ) ; } public static void Main ( String [ ] args ) { double r = 4 ; diameter ( r ) ; } }
Slope of the line parallel to the line with the given slope | C # implementation of the approach ; Function to return the slope of the line which is parallel to the line with the given slope ; Driver code
class GFG { static double getSlope ( double m ) { return m ; } static void Main ( ) { double m = 2 ; System . Console . Write ( getSlope ( m ) ) ; } }
Total number of triangles formed when there are H horizontal and V vertical lines | C # implementation of the approach ; Function to return total triangles ; Only possible triangle is the given triangle ; If only vertical lines are present ; If only horizontal lines are present ; Return total triangles ; Driver code
using System ; class GFG { public static int totalTriangles ( int h , int v ) { if ( h == 0 && v == 0 ) return 1 ; if ( h == 0 ) return ( ( v + 1 ) * ( v + 2 ) / 2 ) ; if ( v == 0 ) return ( h + 1 ) ; int total = ( h + 1 ) * ( ( v + 1 ) * ( v + 2 ) / 2 ) ; return total ; } public static void Main ( ) { int h = 2 , v = 2 ; Console . Write ( totalTriangles ( h , v ) ) ; } }
Largest sphere that can be inscribed in a right circular cylinder inscribed in a frustum | C # Program to find the biggest sphere that can be inscribed within a right circular cylinder which in turn is inscribed within a frustum ; Function to find the biggest sphere ; the radii and height cannot be negative ; radius of the sphere ; volume of the sphere ; Driver code
using System ; class gfg { static float sph ( float r , float R , float h ) { if ( r < 0 && R < 0 && h < 0 ) return - 1 ; float x = r ; float V = ( float ) ( 4 * 3.14f * Math . Pow ( r , 3 ) ) / 3 ; return V ; } public static void Main ( ) { float r = 5 , R = 8 , h = 11 ; Console . WriteLine ( sph ( r , R , h ) ) ; } }
Check whether two straight lines are orthogonal or not | C # implementation of above approach ; Function to check if two straight lines are orthogonal or not ; Both lines have infinite slope ; Only line 1 has infinite slope ; Only line 2 has infinite slope ; Find slopes of the lines ; Check if their product is - 1 ; Driver code
using System ; class GFG { static bool checkOrtho ( int x1 , int y1 , int x2 , int y2 , int x3 , int y3 , int x4 , int y4 ) { int m1 , m2 ; if ( x2 - x1 == 0 && x4 - x3 == 0 ) return false ; else if ( x2 - x1 == 0 ) { m2 = ( y4 - y3 ) / ( x4 - x3 ) ; if ( m2 == 0 ) return true ; else return false ; } else if ( x4 - x3 == 0 ) { m1 = ( y2 - y1 ) / ( x2 - x1 ) ; if ( m1 == 0 ) return true ; else return false ; } else { m1 = ( y2 - y1 ) / ( x2 - x1 ) ; m2 = ( y4 - y3 ) / ( x4 - x3 ) ; if ( m1 * m2 == - 1 ) return true ; else return false ; } } public static void Main ( ) { int x1 = 0 , y1 = 4 , x2 = 0 , y2 = - 9 ; int x3 = 2 , y3 = 0 , x4 = - 1 , y4 = 0 ; if ( checkOrtho ( x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }
Diagonal of a Regular Pentagon | C # Program to find the diagonal of a regular pentagon ; Function to find the diagonal of a regular pentagon ; Side cannot be negative ; Length of the diagonal ; Driver code
using System ; public class GFG { static double pentdiagonal ( double a ) { if ( a < 0 ) return - 1 ; double d = 1.22 * a ; return d ; } static public void Main ( ) { double a = 6 ; Console . WriteLine ( pentdiagonal ( a ) ) ; } }
Area of hexagon with given diagonal length | C # program to find the area of Hexagon with given diagonal ; Function to calculate area ; Formula to find area ; Code driven
using System ; public class GFG { public static float hexagonArea ( float d ) { return ( float ) ( ( 3 * Math . Sqrt ( 3 ) * d * d ) / 8 ) ; } static public void Main ( ) { float d = 10 ; Console . WriteLine ( " Area ▁ of ▁ hexagon : ▁ " + hexagonArea ( d ) ) ; } }
Number of squares of side length required to cover an N * M rectangle | CSHARP program to find number of squares of a * a required to cover n * m rectangle ; function to find a number of squares of a * a required to cover n * m rectangle ; Driver code ; function call
using System ; class GFG { static int Squares ( int n , int m , int a ) { return ( ( m + a - 1 ) / a ) * ( ( n + a - 1 ) / a ) ; } static void Main ( ) { int n = 6 , m = 6 , a = 4 ; Console . WriteLine ( Squares ( n , m , a ) ) ; } }