codeparrot/xlcost-text-to-code huggingface dataset:
Total number of unit cells covered by all given Rectangles | C # program to find the number of cells enclosed by the given rectangles ; Update the coordinates lying within the rectangle ; Update arr [ i , j ] for all ( i , j ) lying within the rectangle ; Function to return the total area covered by rectangles ; Stores the number of cells ; arr [ i ] , [ j ] == 1 means that grid is filled by some rectangle ; Driver Code ; ( A [ i , 0 ] , A [ i , 1 ] ) denotes the coordinate of the bottom left of the rectangle ( A [ i , 2 ] , A [ i , 3 ] ) denotes the coordinate of upper right of the rectangle ; Update the coordinates that lie within the rectangle
using System ; class GFG { static readonly int MAX = 1001 ; static bool [ , ] arr = new bool [ MAX , MAX ] ; static void updateArray ( int x1 , int y1 , int x2 , int y2 ) { for ( int i = x1 ; i < x2 ; i ++ ) { for ( int j = y1 ; j < y2 ; j ++ ) { arr [ i , j ] = true ; } } } static int findAreaCovered ( ) { int area = 0 ; for ( int i = 0 ; i < MAX ; i ++ ) { for ( int j = 0 ; j < MAX ; j ++ ) { if ( arr [ i , j ] == true ) { area ++ ; } } } return area ; } public static void Main ( String [ ] args ) { int N = 3 ; int [ , ] A = { { 1 , 3 , 4 , 5 } , { 3 , 1 , 7 , 4 } , { 5 , 3 , 8 , 6 } } ; for ( int i = 0 ; i < N ; i ++ ) { updateArray ( A [ i , 0 ] , A [ i , 1 ] , A [ i , 2 ] , A [ i , 3 ] ) ; } int area = findAreaCovered ( ) ; Console . Write ( area ) ; } }
Find the equation of plane which passes through two points and parallel to a given axis | C # implementation to find the equation of plane which passes through two points and parallel to a given axis ; Find direction vector of points ( x1 , y1 , z1 ) and ( x2 , y2 , z2 ) ; Values that are calculated and simplified from the cross product ; Print the equation of plane ; Driver code ; Point A ; Point B ; Given axis ; Function Call
using System ; class GFG { static void findEquation ( int x1 , int y1 , int z1 , int x2 , int y2 , int z2 , int d , int e , int f ) { double a = x2 - x1 ; double b = y2 - y1 ; double c = z2 - z1 ; int A = ( int ) ( b * f - c * e ) ; int B = ( int ) ( a * f - c * d ) ; int C = ( int ) ( a * e - b * d ) ; int D = - ( int ) ( A * d - B * e + C * f ) ; Console . Write ( A + " x ▁ + ▁ " + B + " y ▁ + ▁ " + C + " z ▁ + ▁ " + D + " = ▁ 0 ▁ " ) ; } public static void Main ( ) { int x1 = 2 , y1 = 3 , z1 = 5 ; int x2 = 6 , y2 = 7 , z2 = 8 ; int a = 11 , b = 23 , c = 10 ; findEquation ( x1 , y1 , z1 , x2 , y2 , z2 , a , b , c ) ; } }
Find the length of the median of a Triangle if length of sides are given | C # program to find the length of the median using sides of the triangle ; Function to return the length of the median using sides of triangle ; Driver code ; Function call ; Print readonly answer with 2 digits after decimal
using System ; class GFG { public static float median ( int a , int b , int c ) { float n = ( float ) ( Math . Sqrt ( 2 * b * b + 2 * c * c - a * a ) / 2 ) ; return n ; } public static void Main ( String [ ] args ) { int a , b , c ; a = 4 ; b = 3 ; c = 5 ; float ans = median ( a , b , c ) ; Console . WriteLine ( String . Format ( " { 0 : F2 } " , ans ) ) ; } }
Number of quadrilateral formed with N distinct points on circumference of Circle | C # implementation to find the number of quadrilaterals formed with N distinct points ; Function to find the number of combinations in the N ; Function to find the factorial of the given number N ; Loop to find the factorial of the given number ; Driver Code ; Function Call
using System ; class GFG { static int nCr ( int n , int r ) { return ( fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ) ; } static int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i < n + 1 ; i ++ ) res = res * i ; return res ; } public static void Main ( String [ ] args ) { int n = 5 ; Console . Write ( nCr ( n , 4 ) ) ; } }
Length of remaining two sides of a Triangle from a given side and its adjacent angles | C # program for above approach ; Function for computing other 2 side of the trianlgle ; Computing angle C ; Converting A in to radian ; Converting B in to radian ; Converting C in to radian ; Computing length of side b ; Computing length of side c ; Driver code ; Calling function
using System ; class GFG { static void findSide ( float a , double B , double C ) { double A = 180 - C - B ; double radA = ( Math . PI * ( A / 180 ) ) ; double radB = ( Math . PI * ( B / 180 ) ) ; double radC = ( Math . PI * ( C / 180 ) ) ; double b = ( a / Math . Sin ( radA ) * Math . Sin ( radB ) ) ; double c = ( a / Math . Sin ( radA ) * Math . Sin ( radC ) ) ; Console . Write ( " { 0 : F15 } " , b ) ; Console . Write ( " { 0 : F15 } " , c ) ; } public static void Main ( String [ ] args ) { int a = 12 , B = 60 , C = 30 ; findSide ( a , B , C ) ; } }
Minimum area of square holding two identical rectangles | C # program for the above problem ; Function to find the area of the square ; Larger side of rectangle ; Smaller side of the rectangle ; Driver code
using System ; class GFG { public static int areaSquare ( int L , int B ) { int large = Math . Max ( L , B ) ; int small = Math . Min ( L , B ) ; if ( large >= 2 * small ) { return large * large ; } else { return ( 2 * small ) * ( 2 * small ) ; } } public static void Main ( ) { int L = 7 ; int B = 4 ; Console . Write ( areaSquare ( L , B ) ) ; } }
Minimum side of square embedded in Regular polygon with N sides | C # program to find the minimum side of the square in which a regular polygon with even sides can completely embed ; PI value in Java using acos function ; Function to find the minimum side of the square in which a regular polygon with even sides can completely embed ; Projection angle variation from axes ; Projection angle variation when the number of sides are in multiple of 4 ; Distance between the end points ; Projection from all N points on X - axis ; Projection from all N points on Y - axis ; Maximum side ; Return the portion of side forming the square ; Driver code
using System ; class GFG { static double pi = Math . Acos ( - 1.0 ) ; static double nGon ( int N ) { double proAngleVar ; if ( N % 4 == 0 ) { proAngleVar = pi * ( 180.0 / N ) / 180 ; } else { proAngleVar = pi * ( 180.0 / ( 2 * N ) ) / 180 ; } double negX = 1.0e+99 , posX = - 1.0e+99 , negY = 1.0e+99 , posY = - 1.0e+99 ; for ( int j = 0 ; j < N ; ++ j ) { double px = Math . Cos ( 2 * pi * j / N + proAngleVar ) ; double py = Math . Sin ( 2 * pi * j / N + proAngleVar ) ; negX = Math . Min ( negX , px ) ; posX = Math . Max ( posX , px ) ; negY = Math . Min ( negY , py ) ; posY = Math . Max ( posY , py ) ; } double opt2 = Math . Max ( posX - negX , posY - negY ) ; return ( double ) opt2 / Math . Sin ( pi / N ) / 2 ; } public static void Main ( ) { int N = 10 ; Console . Write ( string . Format ( " { 0 : F5 } " , nGon ( N ) ) ) ; } }
Heptacontagon Number | C # program for the above approach ; Finding the nth heptacontagon number ; Driver Code
using System ; class GFG { static int heptacontagonNum ( int n ) { return ( 68 * n * n - 66 * n ) / 2 ; } public static void Main ( ) { int N = 3 ; Console . Write ( "3rd ▁ heptacontagon ▁ Number ▁ is ▁ = ▁ " + heptacontagonNum ( N ) ) ; } }
Program to check if N is a Icositetragonal number | C # implementation to check that a number is icositetragonal number or not ; Function to check that the number is a icositetragonal number ; Condition to check if the number is a icositetragonal number ; Driver Code ; Function call
using System ; class GFG { static bool isicositetragonal ( int N ) { float n = ( float ) ( ( 10 + Math . Sqrt ( 44 * N + 100 ) ) / 22 ) ; return ( n - ( int ) n ) == 0 ; } public static void Main ( ) { int i = 24 ; if ( isicositetragonal ( i ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }
Program to check if N is a Tridecagonal Number or not | C # implementation to check that a number is a tridecagon number or not ; Function to check that the number is a tridecagon number ; Condition to check if the number is a tridecagon number ; Driver Code ; Function call
using System ; class GFG { static bool isTridecagon ( int N ) { float n = ( float ) ( ( 9 + Math . Sqrt ( 88 * N + 81 ) ) / 22 ) ; return ( n - ( int ) n ) == 0 ; } public static void Main ( ) { int i = 13 ; if ( isTridecagon ( i ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }
Program to check if N is a Icosihenagonal number | C # implementation to check that a number is icosihenagonal number or not ; Function to check that the number is a icosihenagonal number ; Condition to check if the number is a icosihenagonal number ; Driver Code ; Function call
using System ; class GFG { static bool isicosihenagonal ( int N ) { float n = ( float ) ( ( 17 + Math . Sqrt ( 152 * N + 289 ) ) / 38 ) ; return ( n - ( int ) n ) == 0 ; } public static void Main ( ) { int i = 21 ; if ( isicosihenagonal ( i ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }
Program to check if N is a Icositrigonal number | C # implementation to check that a number is a icositrigonal number or not ; Function to check that the number is a icositrigonal number ; Condition to check if the number is a icositrigonal number ; Driver Code ; Function call
using System ; class GFG { static bool isicositrigonal ( int N ) { float n = ( float ) ( 19 + Math . Sqrt ( 168 * N + 361 ) ) / 42 ; return ( n - ( int ) n ) == 0 ; } public static void Main ( ) { int i = 23 ; if ( isicositrigonal ( i ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }
Check whether triangle is valid or not if three points are given | C # implementation to check if three points form a triangle ; Function to check if three points make a triangle ; Calculation the area of triangle . We have skipped multiplication with 0.5 to avoid floating point computations ; Condition to check if area is not equal to 0 ; Driver code
using System ; class GFG { static void checkTriangle ( int x1 , int y1 , int x2 , int y2 , int x3 , int y3 ) { int a = x1 * ( y2 - y3 ) + x2 * ( y3 - y1 ) + x3 * ( y1 - y2 ) ; if ( a == 0 ) Console . WriteLine ( " No " ) ; else Console . WriteLine ( " Yes " ) ; } public static void Main ( ) { int x1 = 1 , y1 = 1 , x2 = 2 , y2 = 2 , x3 = 3 , y3 = 3 ; checkTriangle ( x1 , y1 , x2 , y2 , x3 , y3 ) ; } }
Total number of triplets ( A , B , C ) in which the points B and C are Equidistant to A | C # implementation to find the total number of Triplets in which the points are Equidistant ; Function to count such triplets ; Iterate over all the points ; Iterate over all points other than the current point ; Compute squared euclidean distance for the current point ; Compute nP2 that is n * ( n - 1 ) ; Return the final result ; Driver code
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static int numTrip ( ArrayList points ) { int res = 0 ; for ( int i = 0 ; i < points . Count ; ++ i ) { Dictionary < long , int > map = new Dictionary < long , int > ( ) ; for ( int j = 0 ; j < points . Count ; ++ j ) { if ( j == i ) continue ; int dy = ( ( pair ) points [ i ] ) . second - ( ( pair ) points [ j ] ) . second ; int dx = ( ( pair ) points [ i ] ) . first - ( ( pair ) points [ j ] ) . first ; int key = dy * dy ; key += dx * dx ; if ( map . ContainsKey ( key ) ) { map [ key ] ++ ; } else { map [ key ] = 1 ; } } foreach ( int p in map . Values ) res += p * ( p - 1 ) ; } return res ; } public static void Main ( string [ ] args ) { ArrayList mat = new ArrayList ( ) { new pair ( 0 , 0 ) , new pair ( 1 , 0 ) , new pair ( 2 , 0 ) } ; Console . Write ( numTrip ( mat ) ) ; } }
Check if any point overlaps the given Circle and Rectangle | C # implementation to check if any point overlaps the given circle and rectangle ; Function to check if any point overlaps the given circle and rectangle ; Find the nearest point on the rectangle to the center of the circle ; Find the distance between the nearest point and the center of the circle Distance between 2 points , ( x1 , y1 ) & ( x2 , y2 ) in 2D Euclidean space is ( ( x1 - x2 ) * * 2 + ( y1 - y2 ) * * 2 ) * * 0.5 ; Driver code
using System ; class GFG { static bool checkOverlap ( int R , int Xc , int Yc , int X1 , int Y1 , int X2 , int Y2 ) { int Xn = Math . Max ( X1 , Math . Min ( Xc , X2 ) ) ; int Yn = Math . Max ( Y1 , Math . Min ( Yc , Y2 ) ) ; int Dx = Xn - Xc ; int Dy = Yn - Yc ; return ( Dx * Dx + Dy * Dy ) <= R * R ; } public static void Main ( ) { int R = 1 ; int Xc = 0 , Yc = 0 ; int X1 = 1 , Y1 = - 1 ; int X2 = 3 , Y2 = 1 ; if ( checkOverlap ( R , Xc , Yc , X1 , Y1 , X2 , Y2 ) ) { Console . Write ( " True " + " STRNEWLINE " ) ; } else { Console . Write ( " False " ) ; } } }
Check if the tower of sight issue occurs or not | C # program to check if tower of sight issue occurs or not ; Function to check if point p lies in between the line joining p1 and p2 ; If parallel to X - axis ; Point p lies between p1 and p2 ; If parallel to Y - axis ; Point p lies between p1 and p2 ; If point p satisfies the equation of line joining p1 and p2 ; Function to check if tower of sight issue occurred ; B lies between AC ; D lies between AC ; A lies between BD ; C lies between BD ; Driver code ; Point A ; Point B ; Point C ; Point D
using System ; class GFG { class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static int checkIntersection ( pair p1 , pair p2 , pair p ) { int val ; if ( p1 . second == p2 . second && p1 . second == p . second ) { if ( p . first <= Math . Max ( p1 . first , p2 . first ) && ( p . first >= Math . Min ( p1 . first , p2 . first ) ) ) return 1 ; } if ( p1 . first == p2 . first && p1 . first == p . first ) { if ( p . second <= Math . Max ( p1 . second , p2 . second ) && ( p . second >= Math . Min ( p1 . second , p2 . second ) ) ) return 1 ; } else { val = ( p . second - p1 . second ) * ( p2 . first - p1 . first ) - ( p . first - p1 . first ) * ( p2 . second - p1 . second ) ; if ( val == 0 ) if ( ( p . first <= Math . Max ( p1 . first , p2 . first ) && ( p . first >= Math . Min ( p1 . first , p2 . first ) ) ) && ( p . second <= Math . Max ( p1 . second , p2 . second ) && ( p . second >= Math . Min ( p1 . second , p2 . second ) ) ) ) return 1 ; } return 0 ; } static void towerOfSight ( pair a , pair b , pair c , pair d ) { int flag = 0 ; if ( checkIntersection ( a , c , b ) == 1 ) flag = 1 ; else if ( checkIntersection ( a , c , d ) == 1 ) flag = 1 ; else if ( checkIntersection ( b , d , a ) == 1 ) flag = 1 ; else if ( checkIntersection ( b , d , c ) == 1 ) flag = 1 ; Console . Write ( flag == 1 ? " Yes STRNEWLINE " : " No STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { pair a = new pair ( 0 , 0 ) ; pair b = new pair ( 0 , - 2 ) ; pair c = new pair ( 2 , 0 ) ; pair d = new pair ( 0 , 2 ) ; towerOfSight ( a , b , c , d ) ; } }
Number of lines from given N points not parallel to X or Y axis | C # program to find the number of lines which are formed from given N points and not parallel to X or Y axis ; Function to find the number of lines which are formed from given N points and not parallel to X or Y axis ; This will store the number of points has same x or y coordinates using the map as the value of coordinate can be very large ; Counting frequency of each x and y coordinates ; Total number of pairs can be formed ; We can not choose pairs from these as they have same x coordinatethus they will result line segment parallel to y axis ; we can not choose pairs from these as they have same y coordinate thus they will result line segment parallel to x - axis ; Return the required answer ; Driver Code ; Function call
using System ; using System . Collections . Generic ; class GFG { static int NotParallel ( int [ , ] p , int n ) { Dictionary < int , int > x_axis = new Dictionary < int , int > ( ) ; Dictionary < int , int > y_axis = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( x_axis . ContainsKey ( p [ i , 0 ] ) ) x_axis [ p [ i , 0 ] ] = x_axis [ p [ i , 0 ] ] + 1 ; else x_axis . Add ( p [ i , 0 ] , 1 ) ; if ( y_axis . ContainsKey ( p [ i , 1 ] ) ) y_axis [ p [ i , 1 ] ] = y_axis [ p [ i , 1 ] ] + 1 ; else y_axis . Add ( p [ i , 1 ] , 1 ) ; } int total = ( n * ( n - 1 ) ) / 2 ; foreach ( KeyValuePair < int , int > i in x_axis ) { int c = i . Value ; total -= ( c * ( c - 1 ) ) / 2 ; } foreach ( KeyValuePair < int , int > i in y_axis ) { int c = i . Value ; total -= ( c * ( c - 1 ) ) / 2 ; } return total ; } public static void Main ( String [ ] args ) { int [ , ] p = { { 1 , 2 } , { 1 , 5 } , { 1 , 15 } , { 2 , 10 } } ; int n = p . GetLength ( 0 ) ; Console . Write ( NotParallel ( p , n ) ) ; } }
Check whether two convex regular polygon have same center or not | C # implementation to check whether two convex polygons have same center ; Function to check whether two convex polygons have the same center or not ; Driver Code
using System ; class GFG { static int check ( int n , int m ) { if ( m % n == 0 ) { Console . Write ( " YES " ) ; } else { Console . Write ( " NO " ) ; } return 0 ; } public static void Main ( String [ ] args ) { int n = 5 ; int m = 10 ; check ( n , m ) ; } }
Modulus of a Complex Number | C # program to find the Modulus of a Complex Number ; Function to find modulus of a complex number ; Storing the index of ' + ' ; Storing the index of ' - ' ; Finding the real part of the complex number ; Finding the imaginary part of the complex number ; Driver code
using System ; public class GFG { static void findModulo ( String s ) { int l = s . Length ; int i ; if ( s . Contains ( " + " ) ) { i = s . IndexOf ( " + " ) ; } else { i = s . IndexOf ( " - " ) ; } String real = s . Substring ( 0 , i ) ; String imaginary = s . Substring ( i + 1 , l - i - 2 ) ; int x = Int32 . Parse ( real ) ; int y = Int32 . Parse ( imaginary ) ; Console . Write ( Math . Sqrt ( x * x + y * y ) + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { String s = "3 + 4i " ; findModulo ( s ) ; } }
Minimum number of blocks required to form Hollow Rectangular Prism | C # Implementation to find the minimum no of blocks required to form hollow rectangular prism ; Function to display output ; Function to return minimum no of layers required to form the hollow prism ; Function to calculate no of blocks required for each layer ; No of blocks required for each row ; Check for no of layers is minimum ; Driver function ; Length , width , height of each block ; Side of one wall ; height of each wall
using System ; class GFG { static void disp ( int row_no , int block ) { Console . Write ( row_no * block ) ; } static int row ( int ht , int h ) { return ht / h ; } static void calculate ( int l , int w , int h , int a , int ht ) { int no_block = ( 4 * a ) / l ; int row_no ; if ( h < w ) row_no = row ( ht , w ) ; else row_no = row ( ht , h ) ; disp ( row_no , no_block ) ; } public static void Main ( String [ ] args ) { int l = 50 , w = 20 , h = 35 ; int a = 700 ; int ht = 140 ; calculate ( l , w , h , a , ht ) ; } }
Maximum area of rectangle inscribed in an equilateral triangle | C # implementation to find the maximum area inscribed in an equilateral triangle ; Function to find the maximum area of the rectangle inscribed in an equilateral triangle of side S ; Maximum area of the rectangle inscribed in an equilateral triangle of side S ; Driver Code
using System ; class GFG { static double solve ( int s ) { double area = ( 1.732 * Math . Pow ( s , 2 ) ) / 8 ; return area ; } public static void Main ( String [ ] args ) { int n = 14 ; Console . WriteLine ( solve ( n ) ) ; } }
Area of largest semicircle that can be drawn inside a square | C # program to find Area of semicircle in a square ; Function to find area of semicircle ; Driver code ; side of a square ; Call Function to find the area of semicircle
using System ; class GFG { static float find_Area ( float a ) { float R = a * ( float ) ( 2.0 - Math . Sqrt ( 2 ) ) ; float area = ( float ) ( ( 3.14 * R * R ) / 2.0 ) ; return area ; } public static void Main ( string [ ] args ) { float a = 4 ; Console . WriteLine ( " ▁ Area ▁ of ▁ semicircle ▁ = ▁ " + find_Area ( a ) ) ; } }
Count the number of times graph crosses X | C # 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
using System ; 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 ( ) { int [ ] steps = { 1 , - 1 , 0 , 0 , 1 , 1 , - 3 , 2 } ; int n = steps . Length ; Console . WriteLine ( times ( steps , n ) ) ; } }
Program to find X , Y and Z intercepts of a plane | C # 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
using System ; class GFG { 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 ++ ) { Console . Write ( rslt [ i ] + " ▁ " ) ; } } static void Main ( ) { 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 | C # 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
using System ; class GFG { static void new_vol ( double x ) { if ( x > 0 ) { Console . Write ( " % ▁ change ▁ in ▁ the ▁ " + " volume ▁ of ▁ the ▁ hemisphere : ▁ " + ( Math . Pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . Pow ( x , 2 ) ) / 100 ) + " % " + " ▁ increase STRNEWLINE " ) ; } else if ( x < 0 ) { Console . Write ( " % ▁ change ▁ in ▁ the ▁ " + " volume ▁ of ▁ the ▁ hemisphere : ▁ " + ( Math . Pow ( x , 3 ) / 10000 + 3 * x + ( 3 * Math . Pow ( x , 2 ) ) / 100 ) + " % ▁ decrease STRNEWLINE " ) ; } else { Console . Write ( " Volume ▁ remains ▁ the ▁ same . " ) ; } } public static void Main ( ) { double x = - 10.0 ; new_vol ( x ) ; } }