codeparrot/xlcost-text-to-code huggingface dataset:
Area of Incircle of a Right Angled Triangle | C # code to find the area of inscribed circle of right angled triangle ; Function to find the area of inscribed circle ; Driver code
using System ; class GFG { static double PI = 3.14159265 ; public static double area_inscribed ( double P , double B , double H ) { return ( ( P + B - H ) * ( P + B - H ) * ( PI / 4 ) ) ; } public static void Main ( ) { double P = 3.0 , B = 4.0 , H = 5.0 ; Console . Write ( area_inscribed ( P , B , H ) ) ; } }
Area of Circumcircle of a Right Angled Triangle | C # code to find the area of circumscribed circle of right angled triangle ; Function to find the area of circumscribed circle ; Driver code
using System ; class GFG { static double PI = 3.14159265 ; public static double area_cicumscribed ( double c ) { return ( c * c * ( PI / 4 ) ) ; } public static void Main ( ) { double c = 8.0 ; Console . Write ( area_cicumscribed ( c ) ) ; } }
Largest right circular cylinder that can be inscribed within a cone | C # Program to find the biggest right circular cylinder that can be fit within a right circular cone ; Function to find the biggest right circular cylinder ; radius and height 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 double cyl ( double r , double h ) { if ( r < 0 && h < 0 ) return - 1 ; double R = ( 2 * r ) / 3 ; double H = ( 2 * h ) / 3 ; double V = 3.14 * Math . Pow ( R , 2 ) * H ; return V ; } static public void Main ( ) { double r = 4 , h = 8 ; Console . WriteLine ( cyl ( r , h ) ) ; } }
Largest cube that can be inscribed within a right circular cylinder | C # Program to find the biggest cube inscribed within a right circular cylinder ; Function to find the volume of the cube ; height and radius cannot be negative ; volume of the cube ; Driver code
using System ; class GFG { static float cube ( float h , float r ) { if ( h < 0 && r < 0 ) return - 1 ; float a = ( float ) Math . Pow ( h , 3 ) ; return a ; } public static void Main ( ) { float h = 5 , r = 4 ; Console . Write ( cube ( h , r ) ) ; } }
Volume of biggest sphere within a right circular cylinder | C # Program to find the biggest sphere that can be fit within a right circular cylinder ; Function to find the biggest sphere ; radius and height cannot be negative ; radius of sphere ; Driver code
using System ; class GFG { static float sph ( float r , float h ) { if ( r < 0 && h < 0 ) return - 1 ; float R = r ; return R ; } public static void Main ( ) { float r = 4 , h = 8 ; Console . WriteLine ( sph ( r , h ) ) ; } }
Volume of largest right circular cylinder within a Sphere | C # Program to find the biggest right circular cylinder that can be fit within a sphere ; Function to find the biggest right circular cylinder ; radius cannot be negative ; volume of cylinder ; Driver code
using System ; class GFG { static float cyl ( float R ) { if ( R < 0 ) return - 1 ; float V = ( float ) ( ( 2 * 3.14 * Math . Pow ( R , 3 ) ) / ( 3 * Math . Sqrt ( 3 ) ) ) ; return V ; } public static void Main ( ) { float R = 4 ; Console . WriteLine ( cyl ( R ) ) ; } }
Longest rod that can be inserted within a right circular cylinder | C # Program to find the longest rod that can be fit within a right circular cylinder ; Function to find the side of the cube ; height and radius cannot be negative ; length of rod ; Driver code
using System ; class GFG { static float rod ( float h , float r ) { if ( h < 0 && r < 0 ) return - 1 ; float l = ( float ) ( Math . Sqrt ( Math . Pow ( h , 2 ) + 4 * Math . Pow ( r , 2 ) ) ) ; return l ; } public static void Main ( ) { float h = 4 ; float r = 1.5f ; Console . WriteLine ( rod ( h , r ) ) ; } }
Program to calculate the Area and Perimeter of Incircle of an Equilateral Triangle | C # code to find the area of inscribed circle of equilateral triangle ; function to find the area of inscribed circle ; function to find the perimeter of inscribed circle ; Driver code
using System ; class GFG { static double PI = 3.14159265 ; public static double area_inscribed ( double a ) { return ( a * a * ( PI / 12 ) ) ; } public static double perm_inscribed ( double a ) { return ( PI * ( a / Math . Sqrt ( 3 ) ) ) ; } public static void Main ( ) { double a = 6.0 ; Console . Write ( " Area ▁ of ▁ inscribed ▁ circle ▁ is ▁ : " + area_inscribed ( a ) ) ; Console . Write ( " STRNEWLINE Perimeter ▁ of ▁ inscribed ▁ circle ▁ is ▁ : " + perm_inscribed ( a ) ) ; } }
Largest cube that can be inscribed within a right circular cone | C # Program to find the the biggest cube which can be inscribed within a right circular cone ; Function to find the side of the cube ; height and radius cannot be negative ; side of the cube ; Driver code
using System ; class GFG { static float cube ( float h , float r ) { if ( h < 0 && r < 0 ) return - 1 ; float a = ( h * r * ( float ) Math . Sqrt ( 2 ) ) / ( h + ( float ) Math . Sqrt ( 2 ) * r ) ; return a ; } public static void Main ( ) { float h = 5 , r = 6 ; Console . Write ( cube ( h , r ) ) ; } }
Largest right circular cone that can be inscribed within a sphere | C # Program to find the biggest cone that can be inscribed within a sphere ; Function to find the radius of the cone ; radius cannot be negative ; radius of the cone ; Function to find the height of the cone ; side cannot be negative ; height of the cone ; Driver code
using System ; class GFG { static float coner ( float R ) { if ( R < 0 ) return - 1 ; float r = ( float ) ( 2 * Math . Sqrt ( 2 ) * R ) / 3 ; return r ; } static float coneh ( float R ) { if ( R < 0 ) return - 1 ; float h = ( 4 * R ) / 3 ; return h ; } public static void Main ( ) { float R = 10 ; Console . WriteLine ( " r ▁ = ▁ " + coner ( R ) + " , ▁ " + " h ▁ = ▁ " + coneh ( R ) ) ; } }
Largest cone that can be inscribed within a cube | C # Program to find the biggest cone inscribed within a cube ; Function to find the radius of the cone ; side cannot be negative ; radius of the cone ; Function to find the height of the cone ; side cannot be negative ; height of the cone ; Driver code
using System ; class GFG { static float coneRadius ( float a ) { if ( a < 0 ) return - 1 ; float r = ( float ) ( a / Math . Sqrt ( 2 ) ) ; return r ; } static float coneHeight ( float a ) { if ( a < 0 ) return - 1 ; float h = a ; return h ; } public static void Main ( ) { float a = 6 ; Console . WriteLine ( " r ▁ = ▁ " + coneRadius ( a ) + " , ▁ " + " h ▁ = ▁ " + coneHeight ( a ) ) ; } }
Largest cube that can be inscribed within the sphere | C # Program to find the biggest cube inscribed within a sphere ; Function to find the side of the cube ; radius cannot be negative ; side of the cube ; Driver code
using System ; class Solution { static float largestCube ( float r ) { if ( r < 0 ) return - 1 ; float a = ( 2 * r ) / ( float ) Math . Sqrt ( 3 ) ; return a ; } static void Main ( ) { float r = 5 ; Console . WriteLine ( largestCube ( r ) ) ; } }
Largest sphere that can be inscribed inside a cube | C # Program to find the biggest sphere inscribed within a cube ; Function to find the radius of the sphere ; side cannot be negative ; radius of the sphere ; Driver code
using System ; class GFG { static float sphere ( float a ) { if ( a < 0 ) return - 1 ; float r = a / 2 ; return r ; } static public void Main ( ) { float a = 5 ; Console . WriteLine ( sphere ( a ) ) ; } }
Minimum Cuts can be made in the Chessboard such that it is not divided into 2 parts | C # implementation of above approach ; function that calculates the maximum no . of cuts ; Driver Code ; Calling function .
using System ; public class GFG { static int numberOfCuts ( int M , int N ) { int result = 0 ; result = ( M - 1 ) * ( N - 1 ) ; return result ; } static public void Main ( ) { int M = 4 , N = 4 ; int Cuts = numberOfCuts ( M , N ) ; Console . WriteLine ( " Maximum ▁ cuts ▁ = ▁ " + Cuts ) ; } }
Find maximum volume of a cuboid from the given perimeter and area | C # implementation of the above approach ; function to return maximum volume ; calculate length ; calculate volume ; return result ; Driver code ; Function call
using System ; class GFG { static float maxVol ( float P , float A ) { float l = ( float ) ( P - Math . Sqrt ( P * P - 24 * A ) ) / 12 ; float V = ( float ) ( l * ( A / 2.0 - l * ( P / 4.0 - l ) ) ) ; return V ; } public static void Main ( ) { float P = 20 , A = 16 ; Console . WriteLine ( maxVol ( P , A ) ) ; } }
Program to calculate area and perimeter of a rhombus whose diagonals are given | C # program to calculate area and perimeter of a rhombus using diagonals ; calculate area and perimeter of a rhombus ; Driver code
using System ; class GFG { static int rhombusAreaPeri ( int d1 , int d2 ) { int area , perimeter ; area = ( d1 * d2 ) / 2 ; perimeter = ( int ) ( 2 * Math . Sqrt ( Math . Pow ( d1 , 2 ) + Math . Pow ( d2 , 2 ) ) ) ; Console . WriteLine ( " The ▁ area ▁ of ▁ rhombus ▁ with ▁ " + " diagonals ▁ " + d1 + " ▁ and ▁ " + d2 + " ▁ is ▁ " + area + " . " ) ; Console . WriteLine ( " The ▁ perimeter ▁ of ▁ rhombus ▁ " + " with ▁ diagonals ▁ " + d1 + " ▁ and ▁ " + d2 + " ▁ is ▁ " + perimeter + " . " ) ; return 0 ; } public static void Main ( ) { int d1 = 2 , d2 = 4 ; rhombusAreaPeri ( d1 , d2 ) ; } }
Area of decagon inscribed within the circle | C # Program to find the area of the decagon inscribed within a circle ; Function to find the area of the decagon ; radius cannot be negative ; area of the decagon ; Driver code
using System ; class GFG { static double area ( double r ) { if ( r < 0 ) return - 1 ; double area = ( 5 * Math . Pow ( r , 2 ) * ( 3 - Math . Sqrt ( 5 ) ) * ( Math . Sqrt ( 5 ) + ( ( 2 * Math . Sqrt ( 5 ) ) ) ) / 4 ) ; return area ; } static public void Main ( ) { double r = 8 ; Console . WriteLine ( area ( r ) ) ; } }
Maximum area of rectangle possible with given perimeter | C # to find maximum area rectangle ; Function to find max area ; return area ; Driver code
using System ; class GFG { static int maxArea ( float perimeter ) { int length = ( int ) Math . Ceiling ( perimeter / 4 ) ; int breadth = ( int ) Math . Floor ( perimeter / 4 ) ; return length * breadth ; } public static void Main ( ) { float n = 38 ; Console . WriteLine ( " Maximum ▁ Area ▁ = ▁ " + maxArea ( n ) ) ; } }
Find the foot of perpendicular of a point in a 3 D plane | C # program to find foot of perpendicular of a point in a 3 D plane . ; Function to find foot of perpendicular ; Driver Code ; function call
using System ; using System . Globalization ; class GFG { static void foot ( float a , float b , float c , float d , float x1 , float y1 , float z1 ) { float k = ( - a * x1 - b * y1 - c * z1 - d ) / ( float ) ( a * a + b * b + c * c ) ; float x2 = a * k + x1 ; float y2 = b * k + y1 ; float z2 = c * k + z1 ; NumberFormatInfo form = new NumberFormatInfo ( ) ; form . NumberDecimalSeparator = " . " ; Console . Write ( " ▁ x2 ▁ = ▁ " + x2 . ToString ( form ) ) ; Console . Write ( " ▁ y2 ▁ = ▁ " + y2 . ToString ( form ) ) ; Console . Write ( " ▁ z2 ▁ = ▁ " + z2 . ToString ( form ) ) ; } public static void Main ( String [ ] arr ) { float a = 1 ; float b = - 2 ; float c = 0 ; float d = 0 ; float x1 = - 1 ; float y1 = 3 ; float z1 = 4 ; foot ( a , b , c , d , x1 , y1 , z1 ) ; } }
Equation of parabola from its focus and directrix | C # program to find equation of a parbola using focus and directrix . ; Function to find equation of parabola . ; Driver Code
using System ; class solution { static void equation_parabola ( float x1 , float y1 , float a , float b , float c ) { float t = a * a + b * b ; float a1 = t - ( a * a ) ; float b1 = t - ( b * b ) ; float c1 = ( - 2 * t * x1 ) - ( 2 * c * a ) ; float d1 = ( - 2 * t * y1 ) - ( 2 * c * b ) ; float e1 = - 2 * a * b ; float f1 = ( - c * c ) + ( t * x1 * x1 ) + ( t * y1 * y1 ) ; Console . WriteLine ( " equation ▁ of ▁ parabola ▁ is ▁ " + a1 + " ▁ x ^ 2 ▁ + ▁ " + b1 + " ▁ y ^ 2 ▁ + ▁ " + c1 + " ▁ x ▁ + ▁ " + d1 + " ▁ y ▁ + ▁ " + e1 + " ▁ xy ▁ + ▁ " + f1 + " ▁ = ▁ 0 . " ) ; } public static void Main ( ) { float x1 = 0 ; float y1 = 0 ; float a = 3 ; float b = - 4 ; float c = 2 ; equation_parabola ( x1 , y1 , a , b , c ) ; } }
Minimum squares to evenly cut a rectangle | C # program to find minimum number of squares to make a given rectangle . ; if we take gcd ( l , w ) , this will be largest possible side for square , hence minimum number of square . ; Number of squares . ; Driver code
class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) return a ; return __gcd ( b , a % b ) ; } static int countRectangles ( int l , int w ) { int squareSide = __gcd ( l , w ) ; return ( l * w ) / ( squareSide * squareSide ) ; } public static void Main ( ) { int l = 4 , w = 6 ; System . Console . WriteLine ( countRectangles ( l , w ) ) ; } }
Equation of circle from center and radius | C # program to find the equation of circle . ; Function to find the equation of circle ; Printing result ; Driver code
using System ; class GFG { public static void circle_equation ( double x1 , double y1 , double r ) { double a = - 2 * x1 ; double b = - 2 * y1 ; double c = ( r * r ) - ( x1 * x1 ) - ( y1 * y1 ) ; Console . Write ( " x ^ 2 ▁ + ▁ ( " + a + " ▁ x ) ▁ + ▁ " ) ; Console . Write ( " y ^ 2 ▁ + ▁ ( " + b + " ▁ y ) ▁ = ▁ " ) ; Console . WriteLine ( c + " . " ) ; } public static void Main ( string [ ] arr ) { double x1 = 2 , y1 = - 3 , r = 8 ; circle_equation ( x1 , y1 , r ) ; } }
Program to find the Area and Perimeter of a Semicircle | C # program to find the Area and Perimeter of a Semicircle ; Function for calculating the area ; Formula for finding the area ; Function for calculating the perimeter ; Formula for finding the perimeter ; Driver Code ; Get the radius ; Find the area ; Find the perimeter
using System ; class GFG { static float area ( float r ) { return ( float ) ( ( 0.5 ) * ( 3.14 ) * ( r * r ) ) ; } static float perimeter ( float r ) { return ( float ) ( ( 3.14 ) * ( r ) ) ; } public static void Main ( ) { float r = 10 ; Console . WriteLine ( " The ▁ Area ▁ of ▁ Semicircle : ▁ " + area ( r ) ) ; Console . WriteLine ( " The ▁ Perimeter ▁ of ▁ Semicircle : " + perimeter ( r ) ) ; } }
Check if the given vectors are at equilibrium or not | C # program to check the equilibrium of three vectors ; Function to check the equilibrium of three vectors ; summing the x coordinates ; summing the y coordinates ; summing the z coordinates ; Checking the condition for equilibrium ; Driver code ; Checking for equilibrium
class GFG { static bool checkEquilibrium ( int x1 , int y1 , int z1 , int x2 , int y2 , int z2 , int x3 , int y3 , int z3 ) { int resx = x1 + x2 + x3 ; int resy = y1 + y2 + y3 ; int resz = z1 + z2 + z3 ; if ( resx == 0 & resy == 0 & resz == 0 ) return true ; else return false ; } public static void Main ( ) { int x1 = - 2 , y1 = - 7 , z1 = - 9 , x2 = 5 , y2 = - 14 , z2 = 14 , x3 = - 3 , y3 = 21 , z3 = - 5 ; if ( checkEquilibrium ( x1 , y1 , z1 , x2 , y2 , z2 , x3 , y3 , z3 ) ) System . Console . WriteLine ( " The ▁ vectors ▁ are ▁ " + " at ▁ equilibrium . " ) ; else System . Console . WriteLine ( " The ▁ vectors ▁ are ▁ not ▁ " + " at ▁ equilibrium . " ) ; } }
Find Tangent at a given point on the curve | C # program for find Tangent on a curve at given point ; function for find Tangent ; differentiate given equation ; check that point on the curve or not ; if differentiate is negative ; differentiate is positive ; differentiate is zero ; Driver code ; declare variable ; call function findTangent
using System ; class GFG { static void findTangent ( int A , int x , int y ) { int dif = A - x * 2 ; if ( y == ( 2 * x - x * x ) ) { if ( dif < 0 ) Console . Write ( " y ▁ = ▁ " + dif + " x " + ( x * dif + y ) + " STRNEWLINE " ) ; else if ( dif > 0 ) Console . Write ( " y ▁ = ▁ " + dif + " x + " + - x * dif + y + " STRNEWLINE " ) ; else Console . Write ( " Not ▁ possible " + " STRNEWLINE " ) ; } } public static void Main ( ) { int A = 2 , x = 2 , y = 0 ; findTangent ( A , x , y ) ; } }
Find length of Diagonal of Hexagon | C # Program to find the diagonal of the hexagon ; Function to find the diagonal of the hexagon ; side cannot be negative ; diagonal of the hexagon ; Driver code
using System ; class GFG { static float hexadiagonal ( float a ) { if ( a < 0 ) return - 1 ; return 2 * a ; } public static void Main ( ) { float a = 4 ; Console . WriteLine ( hexadiagonal ( a ) ) ; } }
Program to find the side of the Octagon inscribed within the square | C # Program to find the side of the octagon which can be inscribed within the square ; Function to find the side of the octagon ; side cannot be negative ; side of the octagon ; Driver code ; Get he square side ; Find the side length of the square
using System ; class GFG { static double octaside ( double a ) { if ( a < 0 ) return - 1 ; double s = a / ( Math . Sqrt ( 2 ) + 1 ) ; return s ; } static public void Main ( ) { double a = 4 ; Console . WriteLine ( octaside ( a ) ) ; } }
Check whether it is possible to join two points given on circle such that distance between them is k | C # program to implement above approach ; Return distance between the centers ; Distance between centers ; Case 5 ; SubCase 1 ; Subcase 2 ; Case 1 ; Case 3 ; Case 4 ; Case 2 ; Since value of k will always be an integer ; Driver Code
using System ; class GFG { public class node { public long x , y , r ; } ; static long dis ( long x1 , long y1 , long x2 , long y2 ) { return ( long ) Math . Sqrt ( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ) ; } static Boolean check ( node c1 , node c2 , int k ) { long min = 0 ; long max = 0 ; long de = dis ( c1 . x , c1 . y , c2 . x , c2 . y ) ; if ( de == 0 ) { if ( c1 . r == c2 . r ) { min = 0 ; max = 0 ; } else if ( c1 . r - c2 . r > 0 ) { min = c1 . r - c2 . r ; max = min + 2 * c2 . r ; } else { min = c2 . r - c1 . r ; max = min + 2 * c1 . r ; } } else if ( de >= c1 . r + c2 . r ) { min = de - c1 . r - c2 . r ; max = de + c1 . r + c2 . r ; } else if ( de + c2 . r < c1 . r ) { max = c2 . r + c1 . r + de ; min = c1 . r - de - c2 . r ; } else if ( de + c1 . r < c2 . r ) { max = c2 . r + c1 . r + de ; min = c2 . r - de - c1 . r ; } else if ( ( de + c2 . r >= c1 . r ) || ( de + c1 . r >= c2 . r ) ) { max = c2 . r + c1 . r + de ; min = 0 ; } long temin = ( long ) ( Math . Ceiling ( ( double ) min ) ) ; long re = ( long ) max ; if ( k >= temin && k <= re ) { return true ; } return false ; } public static void Main ( String [ ] args ) { node circle1 = new node ( ) ; node circle2 = new node ( ) ; int k = 3 ; circle1 . x = 0 ; circle1 . y = 0 ; circle1 . r = 5 ; circle2 . x = 8 ; circle2 . y = 3 ; circle2 . r = 2 ; if ( check ( circle1 , circle2 , k ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }
Check if it is possible to move from ( 0 , 0 ) to ( x , y ) in N steps | C # program to check whether it is possible or not to move from ( 0 , 0 ) to ( x , y ) in exactly n steps ; Function to check whether it is possible or not to move from ( 0 , 0 ) to ( x , y ) in exactly n steps ; Driver code
using System ; class GFG { static bool Arrive ( int a , int b , int n ) { if ( n >= Math . Abs ( a ) + Math . Abs ( b ) && ( n - ( Math . Abs ( a ) + Math . Abs ( b ) ) ) % 2 == 0 ) return true ; return false ; } public static void Main ( ) { int a = 5 , b = 5 , n = 11 ; if ( Arrive ( a , b , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }
Check if it is possible to move from ( a , 0 ) to ( b , 0 ) with given jumps | C # program to move form ( a , 0 ) to ( b , 0 ) with given jumps ; Function to check if it is possible ; Driver code ; function call
using System ; class GFG { static bool Move ( int a , int x , int b ) { if ( ( ( ( b - a ) % x == 0 ) || ( ( b - a - 1 ) % x == 0 ) && a + 1 != b ) && b >= a ) return true ; return false ; } public static void Main ( ) { int a = 3 , x = 2 , b = 7 ; if ( Move ( a , x , b ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }
Area of a triangle inscribed in a rectangle which is inscribed in an ellipse | C # Program to find the area of the triangle inscribed within the rectangle which in turn is inscribed in an ellipse ; Function to find the area of the triangle ; length of a and b cannot be negative ; area of the triangle ; Driver code
using System ; class GFG { static float area ( float a , float b ) { if ( a < 0 b < 0 ) return - 1 ; float A = a * b ; return A ; } static public void Main ( ) { float a = 5 , b = 2 ; Console . WriteLine ( area ( a , b ) ) ; } }
Circumradius of the rectangle | C # Program to find the radius of the circumcircle of the given rectangle ; Function to find the radius of the circumcircle ; the sides cannot be negative ; Radius of the circumcircle ; Return the radius ; Driver code ; Get the sides of the triangle ; Find the radius of the circumcircle
using System ; class GFG { static float findRadiusOfcircumcircle ( float l , float b ) { if ( l < 0 b < 0 ) return - 1 ; float radius = ( float ) Math . Sqrt ( Math . Pow ( l , 2 ) + Math . Pow ( b , 2 ) ) / 2 ; return radius ; } public static void Main ( ) { float l = 4 , b = 3 ; Console . WriteLine ( findRadiusOfcircumcircle ( l , b ) ) ; } }
Area of the circumcircle of any triangles with sides given | C # Program to find the area the circumcircle of the given triangle ; Function to find the area of the circumcircle ; the sides cannot be negative ; semi - perimeter of the circle ; area of triangle ; area of the circle ; Driver code ; Get the sides of the triangle ; Find and print the area of the circumcircle
using System ; class gfg { public double circlearea ( double a , double b , double c ) { if ( a < 0 b < 0 c < 0 ) return - 1 ; double p = ( a + b + c ) / 2 ; double At = Math . Sqrt ( p * ( p - a ) * ( p - b ) * ( p - c ) ) ; double A = 3.14 * Math . Pow ( ( ( a * b * c ) / ( 4 * At ) ) , 2 ) ; return A ; } } class geek { public static int Main ( ) { gfg g = new gfg ( ) ; double a = 4 , b = 5 , c = 3 ; Console . WriteLine ( g . circlearea ( a , b , c ) ) ; return 0 ; } }
Find the altitude and area of an isosceles triangle | C # program to find the Altitude Area of an isosceles triangle ; function to find the altitude ; return altitude ; function to find the area ; return area ; Driver Code
using System ; class GFG { static float altitude ( float a , float b ) { return ( float ) ( Math . Sqrt ( Math . Pow ( a , 2 ) - ( Math . Pow ( b , 2 ) / 4 ) ) ) ; } static float area ( float b , float h ) { return ( 1 * b * h ) / 2 ; } public static void Main ( ) { float a = 2 , b = 3 ; float h = altitude ( a , b ) ; Console . WriteLine ( " Altitude ▁ = ▁ " + h + " , ▁ " ) ; Console . WriteLine ( " Area ▁ = ▁ " + area ( b , h ) ) ; } }
Program to find the surface area of the square pyramid | C # program to find the surface area Of Square pyramid ; function to find the surface area ; Driver Code ; surface area of the square pyramid
using System ; class GFG { static int surfaceArea ( int b , int s ) { return 2 * b * s + ( int ) Math . Pow ( b , 2 ) ; } public static void Main ( ) { int b = 3 , s = 4 ; Console . WriteLine ( surfaceArea ( b , s ) ) ; } }
Area of largest triangle that can be inscribed within a rectangle | C # Program to find the biggest triangle which can be inscribed within the rectangle ; Function to find the area of the triangle ; a and b cannot be negative ; area of the triangle ; Driver code
using System ; class GFG { static float trianglearea ( float l , float b ) { if ( l < 0 b < 0 ) return - 1 ; float area = ( l * b ) / 2 ; return area ; } public static void Main ( ) { float l = 5 , b = 4 ; Console . WriteLine ( trianglearea ( l , b ) ) ; } }
Check if any square ( with one colored cell ) can be divided into two equal parts | C # program to illustrate the above problem ; function to check if it 's possible to divide the square in two equal parts ; if the painted square is linked anyway to the center of the square then it 's not possible ; else yes it 's possible ; Driver code ; initialize the size of the square ; initialize the dimension of the painted square
using System ; class GFG { static void halfsquare ( int n , int x , int y ) { int half = n / 2 ; if ( ( half == x half == x - 1 ) && ( half == y half == y - 1 ) ) Console . WriteLine ( " NO " ) ; else Console . WriteLine ( " YES " ) ; } public static void Main ( ) { int n = 100 ; int x = 51 , y = 100 ; halfsquare ( n , x , y ) ; } }