codeparrot/xlcost-text-to-code huggingface dataset:
Number of common tangents between two circles if their centers and radius is given | C # program to find the number of common tangents between the two circles ; Driver code
using System ; class GFG { static int circle ( int x1 , int y1 , int x2 , int y2 , int r1 , int r2 ) { int distSq = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ; int radSumSq = ( r1 + r2 ) * ( r1 + r2 ) ; if ( distSq == radSumSq ) return 1 ; else if ( distSq > radSumSq ) return - 1 ; else return 0 ; } public static void Main ( String [ ] args ) { int x1 = - 10 , y1 = 8 ; int x2 = 14 , y2 = - 24 ; int r1 = 30 , r2 = 10 ; int t = circle ( x1 , y1 , x2 , y2 , r1 , r2 ) ; if ( t == 1 ) Console . WriteLine ( " There ▁ are ▁ 3 ▁ common ▁ tangents " + " ▁ between ▁ the ▁ circles . " ) ; else if ( t < 0 ) Console . WriteLine ( " There ▁ are ▁ 4 ▁ common ▁ tangents " + " ▁ between ▁ the ▁ circles . " ) ; else Console . WriteLine ( " There ▁ are ▁ 2 ▁ common ▁ tangents " + " ▁ between ▁ the ▁ circles . " ) ; } }
Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles | C # program to find the ratio of the distance between the centres of the circles and the point of intersection of two transverse common tangents to the circles which do not touch each other ; Function to find the ratio ; Driver code
using System ; class GFG { static int GCD ( int a , int b ) { return ( b != 0 ? GCD ( b , a % b ) : a ) ; } static void ratiotang ( int r1 , int r2 ) { Console . WriteLine ( " The ▁ ratio ▁ is ▁ " + r1 / GCD ( r1 , r2 ) + " : " + r2 / GCD ( r1 , r2 ) ) ; } static public void Main ( ) { int r1 = 4 , r2 = 8 ; ratiotang ( r1 , r2 ) ; } }
Program to find the number of region in Planar Graph | C # implementation of the approach ; Function to return the number of regions in a Planar Graph ; Driver code
using System ; class GFG { static int Regions ( int Vertices , int Edges ) { int R = Edges + 2 - Vertices ; return R ; } static public void Main ( ) { int V = 5 , E = 7 ; Console . WriteLine ( Regions ( V , E ) ) ; } }
Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles | C # program to find the ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles which do not touch each other ; Function to find the GCD ; Function to find the ratio ; Driver code
using System ; class GFG { static int GCD ( int a , int b ) { return ( b != 0 ? GCD ( b , a % b ) : a ) ; } static void ratiotang ( int r1 , int r2 ) { Console . WriteLine ( " The ▁ ratio ▁ is ▁ " + r1 / GCD ( r1 , r2 ) + " ▁ : ▁ " + r2 / GCD ( r1 , r2 ) ) ; } public static void Main ( String [ ] args ) { int r1 = 4 , r2 = 6 ; ratiotang ( r1 , r2 ) ; } }
Length of the transverse common tangent between the two non intersecting circles | C # program to find the length of the transverse common tangent between two circles which do not touch each other ; Function to find the length of the transverse common tangent ; Driver code
using System ; class GFG { static void lengthOfTangent ( double r1 , double r2 , double d ) { Console . WriteLine ( " The ▁ length ▁ of ▁ the ▁ transverse " + " ▁ common ▁ tangent ▁ is ▁ " + Math . Sqrt ( Math . Pow ( d , 2 ) - Math . Pow ( ( r1 + r2 ) , 2 ) ) ) ; } static public void Main ( ) { double r1 = 4 , r2 = 6 , d = 12 ; lengthOfTangent ( r1 , r2 , d ) ; } }
Area of plot remaining at the end | C # implementation of the approach ; Function to return the area of the remaining plot ; Continue while plot has positive area and there are persons left ; If length > breadth then subtract breadth from length ; Else subtract length from breadth ; Driver code
using System ; class GFG { static int remainingArea ( int N , int M , int K ) { while ( K -- > 0 && N > 0 && M > 0 ) { if ( N > M ) N = N - M ; else M = M - N ; } if ( N > 0 && M > 0 ) return N * M ; else return 0 ; } static public void Main ( ) { int N = 5 , M = 3 , K = 2 ; Console . WriteLine ( remainingArea ( N , M , K ) ) ; } }
Length of the direct common tangent between two externally touching circles | C # program to find the length of the direct common tangent between two circles which externally touch each other ; Function to find the length of the direct common tangent ; Driver code
using System ; class GFG { static void lengtang ( double r1 , double r2 ) { Console . WriteLine ( " The ▁ length ▁ of ▁ the ▁ " + " direct ▁ common ▁ tangent ▁ is ▁ " + ( 2 * Math . Sqrt ( r1 * r2 ) ) ) ; } static public void Main ( ) { double r1 = 5 , r2 = 9 ; lengtang ( r1 , r2 ) ; } }
Shortest distance between a point and a circle | C # program to find the Shortest distance between a point and a circle ; Function to find the shortest distance ; Driver code
using System ; class GFG { static void dist ( double x1 , double y1 , double x2 , double y2 , double r ) { Console . WriteLine ( " The ▁ shortest ▁ distance ▁ " + " between ▁ a ▁ point ▁ and ▁ a ▁ circle ▁ is ▁ " + ( Math . Sqrt ( ( Math . Pow ( ( x2 - x1 ) , 2 ) ) + ( Math . Pow ( ( y2 - y1 ) , 2 ) ) ) - r ) ) ; } public static void Main ( String [ ] args ) { double x1 = 4 , y1 = 6 , x2 = 35 , y2 = 42 , r = 5 ; dist ( x1 , y1 , x2 , y2 , r ) ; } }
Distance between two parallel lines | C # program find the distance between two parallel lines ; Function to find the distance between parallel lines ; Driver Code
using System ; class GFG { static double dist ( double m , double b1 , double b2 ) { double d = Math . Abs ( b2 - b1 ) / ( ( m * m ) - 1 ) ; return d ; } public static void Main ( ) { double m = 2 , b1 = 4 , b2 = 3 ; Console . Write ( dist ( m , b1 , b2 ) ) ; } }
Length of the normal from origin on a straight line whose intercepts are given | C # implementation of the approach ; Function to find the normal of the straight line ; Length of the normal ; Driver code
using System ; class GFG { static float normal ( float m , float n ) { float N = ( float ) ( ( Math . Abs ( m ) * Math . Abs ( n ) ) / Math . Sqrt ( ( Math . Abs ( m ) * Math . Abs ( m ) ) + ( Math . Abs ( n ) * Math . Abs ( n ) ) ) ) ; return N ; } public static void Main ( ) { float m = - 5 , n = 3 ; Console . Write ( normal ( m , n ) ) ; } }
Check if it is possible to create a polygon with given n sides | C # implementation of the approach ; Function that returns true if it is possible to form a polygon with the given sides ; Sum stores the sum of all the sides and maxS stores the length of the largest side ; If the length of the largest side is less than the sum of the other remaining sides ; Driver code
using System ; class GFG { static bool isPossible ( int [ ] a , int n ) { int sum = 0 , maxS = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; maxS = Math . Max ( a [ i ] , maxS ) ; } if ( ( sum - maxS ) > maxS ) return true ; return false ; } static void Main ( ) { int [ ] a = { 2 , 3 , 4 } ; int n = a . Length ; if ( isPossible ( a , n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Find the area of the shaded region formed by the intersection of four semicircles in a square | C # implementation of the approach ; Function to return the area of the shaded region ; Area of the square ; Area of the semicircle ; There are 4 semicircles shadedArea = Area of 4 semicircles - Area of square ; Driver code
using System ; class GFG { static float findAreaShaded ( float a ) { float sqArea = a * a ; float semiCircleArea = ( float ) ( 3.14 * ( a * a ) / 8 ) ; float ShadedArea = 4 * semiCircleArea - sqArea ; return ShadedArea ; } public static void Main ( ) { float a = 10 ; Console . WriteLine ( findAreaShaded ( a ) ) ; } }
Number of steps required to reach point ( x , y ) from ( 0 , 0 ) using zig | C # program to find the number of steps required to reach ( x , y ) from ( 0 , 0 ) following a zig - zag path ; Function to return the required position ; Driver Code
using System ; class GfG { static int countSteps ( int x , int y ) { if ( x < y ) { return x + y + 2 * ( ( y - x ) / 2 ) ; } else { return x + y + 2 * ( ( ( x - y ) + 1 ) / 2 ) ; } } public static void Main ( ) { int x = 4 , y = 3 ; Console . WriteLine ( countSteps ( x , y ) ) ; } }
Find whether only two parallel lines contain all coordinates points or not | C # implementation of the above approach ; Find if slope is good with only two intercept ; if set of lines have only two distinct intercept ; Function to check if required solution exist ; check the result by processing the slope by starting three points ; Driver code
using System ; using System . Collections . Generic ; class GfG { static bool isSlopeGood ( double slope , int [ ] arr , int n ) { HashSet < Double > setOfLines = new HashSet < Double > ( ) ; for ( int i = 0 ; i < n ; i ++ ) setOfLines . Add ( arr [ i ] - slope * ( i ) ) ; return setOfLines . Count == 2 ; } static bool checkForParallel ( int [ ] arr , int n ) { bool slope1 = isSlopeGood ( arr [ 1 ] - arr [ 0 ] , arr , n ) ; bool slope2 = isSlopeGood ( arr [ 2 ] - arr [ 1 ] , arr , n ) ; bool slope3 = isSlopeGood ( ( arr [ 2 ] - arr [ 0 ] ) / 2 , arr , n ) ; return ( slope1 == true slope2 == true slope3 == true ) ; } public static void Main ( ) { int [ ] arr = { 1 , 6 , 3 , 8 , 5 } ; int n = arr . Length ; if ( checkForParallel ( arr , n ) == true ) Console . WriteLine ( "1" ) ; else Console . WriteLine ( "0" ) ; } }
Check whether the point ( x , y ) lies on a given line | C # implementation of the approach ; Function that return true if the given point lies on the given line ; If ( x , y ) satisfies the equation of the line ; Driver code
using System ; class GFG { static bool pointIsOnLine ( int m , int c , int x , int y ) { if ( y == ( ( m * x ) + c ) ) return true ; return false ; } public static void Main ( ) { int m = 3 , c = 2 ; int x = 1 , y = 5 ; if ( pointIsOnLine ( m , c , x , y ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Find the coordinates of the fourth vertex of a rectangle with given 3 vertices | C # implementation of the approach ; Function that return the coordinates of the fourth vertex of the rectangle ; Save the coordinates of the given vertices of the rectangle ; 1 - based indexing ; Driver Code
using System ; using System . Collections . Generic ; class GfG { static Pair < int , int > findFourthVertex ( int n , int m , String [ ] s ) { Dictionary < int , int > row = new Dictionary < int , int > ( ) ; Dictionary < int , int > col = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( s [ i ] [ j ] == ' * ' ) { if ( row . ContainsKey ( i ) ) { row [ i ] = row [ i ] + 1 ; } else { row . Add ( i , 1 ) ; } if ( col . ContainsKey ( j ) ) { col [ j ] = col [ j ] + 1 ; } else { col . Add ( j , 1 ) ; } } } } int x = 0 , y = 0 ; foreach ( KeyValuePair < int , int > entry in row ) { if ( entry . Value == 1 ) x = entry . Key ; } foreach ( KeyValuePair < int , int > entry in col ) { if ( entry . Value == 1 ) y = entry . Key ; } Pair < int , int > ans = new Pair < int , int > ( x + 1 , y + 1 ) ; return ans ; } public static void Main ( String [ ] args ) { String [ ] s = { " * . * " , " * . . " , " . . . " } ; int n = s . Length ; int m = s [ 0 ] . Length ; Pair < int , int > rs = findFourthVertex ( n , m , s ) ; Console . WriteLine ( rs . first + " ▁ " + rs . second ) ; } } class Pair < A , B > { public A first ; public B second ; public Pair ( A first , B second ) { this . first = first ; this . second = second ; } }
Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse | C # Program to find the biggest Reuleaux triangle inscribed within in a square which in turn is inscribed within an ellipse ; Function to find the biggest reuleaux triangle ; length of the axes cannot be negative ; height of the reuleaux triangle ; area of the reuleaux triangle ; Driver code
using System ; class GFG { static double Area ( double a , double b ) { if ( a < 0 && b < 0 ) return - 1 ; double h = ( double ) Math . Sqrt ( ( ( Math . Pow ( a , 2 ) + Math . Pow ( b , 2 ) ) / ( Math . Pow ( a , 2 ) * Math . Pow ( b , 2 ) ) ) ) ; double A = ( double ) ( 0.70477 * Math . Pow ( h , 2 ) ) ; return A ; } static void Main ( ) { double a = 5 , b = 4 ; Console . WriteLine ( Math . Round ( Area ( a , b ) , 7 ) ) ; } }
Maximum given sized rectangles that can be cut out of a sheet of paper | C # implementation of the above approach ; Function to return the maximum rectangles possible ; Cut rectangles horizontally if possible ; One rectangle is a single cell ; Total rectangles = total cells ; Cut rectangles vertically if possible ; Return the maximum possible rectangles ; Driver code
using System ; class GFG { static int maxRectangles ( int L , int B , int l , int b ) { int horizontal = 0 , vertical = 0 ; if ( l <= L && b <= B ) { int columns = B / b ; int rows = L / l ; horizontal = rows * columns ; } if ( l <= B && b <= L ) { int columns = L / b ; int rows = B / l ; vertical = rows * columns ; } return Math . Max ( horizontal , vertical ) ; } public static void Main ( ) { int L = 10 , B = 7 , l = 4 , b = 3 ; Console . WriteLine ( maxRectangles ( L , B , l , b ) ) ; } }
Largest right circular cone that can be inscribed within a sphere which is inscribed within a cube | C # Program to find the biggest right circular cone that can be inscribed within a right circular cone which in turn is inscribed within a cube ; Function to find the biggest right circular cone ; side cannot be negative ; radius of right circular cone ; height of right circular cone ; volume of right circular cone ; Driver code
using System ; class GFG { static double cone ( double a ) { if ( a < 0 ) return - 1 ; double r = ( double ) ( a * Math . Sqrt ( 2 ) ) / 3 ; double h = ( 2 * a ) / 3 ; double V = ( double ) ( 3.14 * Math . Pow ( r , 2 ) * h ) ; return Math . Round ( V , 4 ) ; } static void Main ( ) { double a = 5 ; Console . WriteLine ( cone ( a ) ) ; } }
Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon | C # Program to find the biggest Reuleaux triangle inscribed within in a square which in turn is inscribed within a hexagon ; Function to find the biggest reuleaux triangle ; side cannot be negative ; height of the reuleaux triangle ; area of the reuleaux triangle ; Driver code
using System ; class GFG { static float Area ( float a ) { if ( a < 0 ) return - 1 ; float h = ( float ) 1.268 * a ; float A = ( float ) ( 0.70477 * Math . Pow ( h , 2 ) ) ; return A ; } public static void Main ( ) { float a = 5 ; Console . WriteLine ( Area ( a ) ) ; } }
Biggest Reuleaux Triangle inscirbed within a square inscribed in a semicircle | C # Program to find the biggest Reuleaux triangle inscribed within in a square which in turn is inscribed within a semicircle ; Function to find the biggest reuleaux triangle ; radius cannot be negative ; height of the reuleaux triangle ; area of the reuleaux triangle ; Driver code
using System ; class GFG { static double Area ( double r ) { if ( r < 0 ) return - 1 ; double x = ( 2 * r ) / ( double ) ( Math . Sqrt ( 5 ) ) ; double A = 0.70477 * ( double ) ( Math . Pow ( x , 2 ) ) ; return A ; } public static void Main ( ) { double r = 5 ; Console . WriteLine ( Area ( r ) ) ; } }
Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle | C # Program to find the biggest Reuleaux triangle inscribed within in a square which in turn is inscribed within an equilateral triangle ; Function to find the biggest reuleaux triangle ; side cannot be negative ; height of the reuleaux triangle ; area of the reuleaux triangle ; Driver code
using System ; class GFG { static float Area ( float a ) { if ( a < 0 ) return - 1 ; float x = 0.464f * a ; float A = 0.70477f * ( float ) Math . Pow ( x , 2 ) ; return A ; } public static void Main ( ) { float a = 5 ; Console . WriteLine ( String . Format ( " { 0,0 : # .00000 } " , Area ( a ) ) ) ; } }
Program for Area Of Square after N | C # program to find the area of the square ; Function to calculate area of square after given number of folds ; Driver Code
using System ; class GFG { static double areaSquare ( double side , double fold ) { double area = side * side ; return area * 1.0 / Math . Pow ( 2 , fold ) ; } public static void Main ( ) { double side = 4 , fold = 2 ; Console . Write ( areaSquare ( side , fold ) ) ; } }
Biggest Reuleaux Triangle within a Square which is inscribed within a Circle | C # Program to find the biggest Reuleaux triangle inscribed within in a square which in turn is inscribed within a circle ; Function to find the Area of the Reuleaux triangle ; radius cannot be negative ; Area of the Reuleaux triangle ; Driver code
using System ; class GFG { static double ReuleauxArea ( double r ) { if ( r < 0 ) return - 1 ; double A = 0.70477 * 2 * Math . Pow ( r , 2 ) ; return A ; } public static void Main ( ) { double r = 6 ; Console . WriteLine ( ReuleauxArea ( r ) ) ; } }
Largest right circular cylinder that can be inscribed within a cone which is in turn inscribed within a cube | C # Program to find the biggest right circular cylinder that can be inscribed within a right circular cone which in turn is inscribed within a cube ; Function to find the biggest right circular cylinder ; side cannot be negative ; radius of right circular cylinder ; height of right circular cylinder ; volume of right circular cylinder ; Driver code
using System ; class GFG { static float cyl ( float a ) { if ( a < 0 ) return - 1 ; float r = ( 2 * a * ( float ) ( Math . Sqrt ( 2 ) ) / 3 ) ; float h = ( 2 * a ) / 3 ; float V = ( 3.14f * ( float ) ( Math . Pow ( r , 2 ) * h ) ) ; return V ; } public static void Main ( ) { float a = 5 ; Console . Write ( cyl ( a ) ) ; } }
Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle | C # Program to find the biggest Reuleaux triangle inscribed within in a square which in turn is inscribed within a circle ; Function to find the biggest reuleaux triangle ; the height or base or hypotenuse cannot be negative ; height of the reuleaux triangle ; area of the reuleaux triangle ; Driver code
using System ; class GFG { static double Area ( double l , double b , double h ) { if ( l < 0 b < 0 h < 0 ) return - 1 ; double x = ( l * b ) / ( l + b ) ; double A = 0.70477 * Math . Pow ( x , 2 ) ; return A ; } public static void Main ( ) { double l = 5 , b = 12 , h = 13 ; Console . WriteLine ( ( Area ( l , b , h ) ) ) ; } }
Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle | C # program to find the side of the largest square that can be inscribed within the hexagon which in return is incsribed within an equilateral triangle ; Function to find the side of the square ; Side cannot be negative ; side of the square ; Driver code
using System ; class GFG { static float squareSide ( float a ) { if ( a < 0 ) return - 1 ; float x = ( 0.423f * a ) ; return x ; } public static void Main ( ) { float a = 8 ; Console . WriteLine ( squareSide ( a ) ) ; } }
Check if it is possible to draw a straight line with the given direction cosines | C # implementation of the approach ; Function that returns true if a straight line is possible ; Driver code
using System ; class GFG { static bool isPossible ( float x , float y , float z ) { float a = x * x + y * y + z * z ; if ( Math . Ceiling ( a ) == 1 && Math . Floor ( a ) == 1 ) return true ; return false ; } public static void Main ( ) { float l = 0.70710678f , m = 0.5f , n = 0.5f ; if ( isPossible ( l , m , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }
Length of Diagonal of a n | C # Program to find the diagonal of a regular polygon with given side length ; Function to find the diagonal of a regular polygon ; Side and side length cannot be negative ; diagonal degree converted to radians ; Driver code
using System ; public class GFG { static float polydiagonal ( float n , float a ) { if ( a < 0 && n < 0 ) { return - 1 ; } return ( float ) ( 2 * a * Math . Sin ( ( ( ( n - 2 ) * 180 ) / ( 2 * n ) ) * 3.14159 / 180 ) ) ; } static public void Main ( ) { float a = 9 , n = 10 ; Console . WriteLine ( polydiagonal ( n , a ) ) ; } }
Diagonal of a Regular Decagon | C # program to find the diagonal of a regular decdiagonal ; Function to return the diagonal of a regular decdiagonal ; side cannot be negative ; length of the diagonal ; Driver code
using System ; public class GFG { static double decdiagonal ( double a ) { if ( a < 0 ) return - 1 ; double d = 1.902 * a ; return d ; } public static void Main ( ) { int a = 9 ; Console . WriteLine ( decdiagonal ( a ) ) ; } }
Diagonal of a Regular Heptagon | C # program to find the diagonal of a regular heptagon ; Function to return the diagonal of a regular heptagon ; side cannot be negative ; length of the diagonal ; Driver code
using System ; public class GFG { static double heptdiagonal ( double a ) { if ( a < 0 ) return - 1 ; double d = 1.802 * a ; return d ; } public static void Main ( ) { int a = 6 ; Console . WriteLine ( heptdiagonal ( a ) ) ; }
Diagonal of a Regular Hexagon | C # Program to find the diagonal of a regular hexagon ; Function to find the diagonal of a regular hexagon ; Side cannot be negative ; Length of the diagonal ; Driver code
using System ; public class GFG { static double hexDiagonal ( float a ) { if ( a < 0 ) return - 1 ; double d = ( double ) 1.73 * a ; return d ; } public static void Main ( ) { float a = 9 ; Console . WriteLine ( hexDiagonal ( a ) ) ; } }
Area of Reuleaux Triangle | C # Program to find the area of Reuleaux triangle ; Function to find the Area of the Reuleaux triangle ; Side cannot be negative ; Area of the Reuleaux triangle ; Driver code
using System ; public class GFG { static double ReuleauxArea ( float a ) { if ( a < 0 ) return - 1 ; double A = ( double ) 0.70477 * Math . Pow ( a , 2 ) ; return A ; } public static void Main ( ) { float a = 6 ; Console . WriteLine ( ReuleauxArea ( a ) ) ; } }
Largest Square that can be inscribed within a hexagon | C # program to find the area of the largest square that can be inscribed within the hexagon ; Function to find the area of the square ; Side cannot be negative ; Area of the square ; Driver code
using System ; class Solution { static float squareArea ( float a ) { if ( a < 0 ) return - 1 ; float area = ( float ) ( Math . Pow ( 1.268 , 2 ) * Math . Pow ( a , 2 ) ) ; return area ; } public static void Main ( ) { float a = 6 ; Console . WriteLine ( squareArea ( a ) ) ; } }
Volume of cube using its space diagonal | C # program to find the volume occupied by Cube with given space diagonal ; Function to calculate Volume ; Formula to find Volume ; Drivers code ; space diagonal of Cube
using System ; public class GFG { static float CubeVolume ( float d ) { float Volume ; Volume = ( float ) ( Math . Sqrt ( 3 ) * Math . Pow ( d , 3 ) ) / 9 ; return Volume ; } public static void Main ( ) { float d = 5 ; Console . WriteLine ( " Volume ▁ of ▁ Cube : ▁ { 0 : F4 } " , CubeVolume ( d ) ) ; } }
Perimeter and Area of Varignon 's Parallelogram | C # code to find the perimeter and area ; Function to find the perimeter ; Function to find the area ; Driver code
using System ; class GFG { public static double per ( double a , double b ) { return ( a + b ) ; } public static double area ( double s ) { return ( s / 2 ) ; } public static void Main ( ) { double a = 7.0 , b = 8.0 , s = 10.0 ; Console . WriteLine ( per ( a , b ) ) ; Console . Write ( area ( s ) ) ; } }
Area of a leaf inside a square | C # code to find the area of leaf inside square ; Function to find the area of leaf ; Driver code
using System ; class GFG { static double PI = 3.14159265 ; public static double area_leaf ( double a ) { return ( a * a * ( PI / 2 - 1 ) ) ; } public static void Main ( ) { double a = 7 ; Console . Write ( area_leaf ( a ) ) ; } }
Length of rope tied around three equal circles touching each other | C # code to find the length of rope ; Function to find the length of rope ; Driver code
using System ; class GFG { static double PI = 3.14159265 ; public static double length_rope ( double r ) { return ( ( 2 * PI * r ) + 6 * r ) ; } public static void Main ( ) { double r = 7.0 ; Console . Write ( length_rope ( r ) ) ; } }