codeparrot/xlcost-text-to-code huggingface dataset:
Check if N can be expressed as product of 3 distinct numbers | C # program to find the three numbers ; function to find 3 distinct number with given product ; Declare a vector to store divisors ; store all divisors of number in array ; store all the occurence of divisors ; check if n is not equals to - 1 then n is also a prime factor ; Initialize the variables with 1 ; check for first number a ; check for second number b ; check for third number c ; check for all unwanted condition ; Driver function
using System ; using System . Collections . Generic ; class GFG { static void getnumbers ( int n ) { List < int > divisor = new List < int > ( ) ; for ( int i = 2 ; i * i <= n ; i ++ ) { while ( n % i == 0 ) { divisor . Add ( i ) ; n /= i ; } } if ( n != 1 ) { divisor . Add ( n ) ; } int a , b , c , size ; a = b = c = 1 ; size = divisor . Count ; for ( int i = 0 ; i < size ; i ++ ) { if ( a == 1 ) { a = a * divisor [ i ] ; } else if ( b == 1 b == a ) { b = b * divisor [ i ] ; } else { c = c * divisor [ i ] ; } } if ( a == 1 b == 1 c == 1 a == b b == c a == c ) { Console . Write ( " - 1" + " STRNEWLINE " ) ; } else { Console . Write ( a + " ▁ " + b + " ▁ " + c + " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int n = 64 ; getnumbers ( n ) ; } }
Check if all Prime factors of number N are unique or not | C # program for the above approach ; Function that returns the all the distinct prime factors in a vector ; If n is divisible by 2 ; Divide n till all factors of 2 ; Check for the prime numbers other than 2 ; Store i in Prime [ ] i is a factor of n ; Divide n till all factors of i ; If n is greater than 2 , then n is prime number after n divided by all factors ; Returns the vector Prime ; Function that check whether N is the product of distinct prime factors or not ; Returns the vector to store all the distinct prime factors ; To find the product of all distinct prime factors ; Find the product ; If product is equals to N , print YES , else print NO ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static List < int > primeFactors ( int n ) { int i ; List < int > Prime = new List < int > ( ) ; if ( n % 2 == 0 ) { Prime . Add ( 2 ) ; } while ( n % 2 == 0 ) { n = n / 2 ; } for ( i = 3 ; i <= Math . Sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { Prime . Add ( i ) ; } while ( n % i == 0 ) { n = n / i ; } } if ( n > 2 ) { Prime . Add ( n ) ; } return Prime ; } static void checkDistinctPrime ( int n ) { List < int > Prime = primeFactors ( n ) ; int product = 1 ; foreach ( int i in Prime ) { product *= i ; } if ( product == n ) Console . Write ( " YES " ) ; else Console . Write ( " NO " ) ; } public static void Main ( String [ ] args ) { int N = 30 ; checkDistinctPrime ( N ) ; } }
Count perfect power of K in a range [ L , R ] | C # implementation to find the count of numbers those are powers of K in range L to R ; Function to find the Nth root of the number ; initially guessing a random number between 0 to 9 ; Smaller eps , denotes more accuracy ; Initializing difference between two roots by int . MaxValue ; xK denotes current value of x ; loop until we reach desired accuracy ; calculating current value from previous value ; Function to count the perfect powers of K in range L to R ; Driver code
using System ; using System . Collections . Generic ; public class GFG { static double nthRoot ( int A , int N ) { Random r = new Random ( ) ; double xPre = r . Next ( 0 , 9 ) ; double eps = 1e-3 ; double delX = int . MaxValue ; double xK = 0 ; while ( delX > eps ) { xK = ( ( N - 1.0 ) * xPre + ( double ) A / Math . Pow ( xPre , N - 1 ) ) / ( double ) N ; delX = Math . Abs ( xK - xPre ) ; xPre = xK ; } return xK ; } static int countPowers ( int a , int b , int k ) { return ( int ) ( Math . Floor ( nthRoot ( b , k ) ) - Math . Ceiling ( nthRoot ( a , k ) ) + 1 ) ; } public static void Main ( String [ ] args ) { int a = 7 , b = 28 , k = 2 ; Console . Write ( " Count ▁ of ▁ Powers ▁ is ▁ " + countPowers ( a , b , k ) ) ; } }
Minimum number of primes required such that their sum is equal to N | C # program for the above approach ; Function to check if n is prime ; Function to count the minimum prime required for given sum N ; Case 1 : ; Case 2 : ; Case 3 : ; Case 3 a : ; Case 3 b : ; Driver Code ; Function Call
using System ; class GFG { static bool isPrime ( int n ) { for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { return false ; } } return true ; } static void printMinCountPrime ( int N ) { int minCount ; if ( isPrime ( N ) ) { minCount = 1 ; } else if ( N % 2 == 0 ) { minCount = 2 ; } else { if ( isPrime ( N - 2 ) ) { minCount = 2 ; } else { minCount = 3 ; } } Console . WriteLine ( minCount + " STRNEWLINE " ) ; } public static void Main ( string [ ] args ) { int N = 100 ; printMinCountPrime ( N ) ; } }
Long Division Method to find Square root with Examples | C # program to find the square root of a number by using long division method ; Function to find the square root of a number by using long division method ; int i = 0 , udigit , j ; Loop counters ; Dividing the number into segments ; Last index of the array of segments ; Start long division from the last segment ( j = i ) ; Initialising the remainder to the maximum value ; Including the next segment in new dividend ; Loop to check for the perfect square closest to each segment ; This condition is to find the divisor after adding a digit in the range 0 to 9 ; Calculating the remainder ; Updating the units digit of the quotient ; Adding units digit to the quotient ; New divisor is two times quotient ; Including the remainder in new dividend ; Driver code
using System ; class GFG { static readonly int INFINITY_ = 9999999 ; static int sqrtBylongDivision ( int n ) { int cur_divisor = 0 ; int quotient_units_digit = 0 ; int cur_quotient = 0 ; int cur_dividend = 0 ; int cur_remainder = 0 ; int [ ] a = new int [ 10 ] ; while ( n > 0 ) { a [ i ] = n % 100 ; n = n / 100 ; i ++ ; } i -- ; for ( j = i ; j >= 0 ; j -- ) { cur_remainder = INFINITY_ ; cur_dividend = cur_dividend * 100 + a [ j ] ; for ( udigit = 0 ; udigit <= 9 ; udigit ++ ) { if ( cur_remainder >= cur_dividend - ( ( cur_divisor * 10 + udigit ) * udigit ) && cur_dividend - ( ( cur_divisor * 10 + udigit ) * udigit ) >= 0 ) { cur_remainder = cur_dividend - ( ( cur_divisor * 10 + udigit ) * udigit ) ; quotient_units_digit = udigit ; } } cur_quotient = cur_quotient * 10 + quotient_units_digit ; cur_divisor = cur_quotient * 2 ; cur_dividend = cur_remainder ; } return cur_quotient ; } public static void Main ( String [ ] args ) { int x = 1225 ; Console . Write ( sqrtBylongDivision ( x ) + " STRNEWLINE " ) ; } }
Count of consecutive Fibonacci pairs in the given Array | C # implementation to count the consecutive fibonacci pairs in the array ; Function to find the previous fibonacci for the number N ; Function to find the next fibonacci number for the number N ; Function to check that a Number is a perfect square or not ; Function to check that a number is fibonacci number or not ; N is Fibinacci if one of ( 5 * n * n + 4 ) or ( 5 * n * n - 4 ) is a perferct square ; Function to count the fibonacci pairs in the array ; Loop to iterate over the array to choose all pairs of the array ; Condition to check if both the number of pair is a fibonacci number ; Condition to check if both the number form consecutive fibonacci numbers ; Driver Code
using System ; class GFG { static int previousFibonacci ( int n ) { double a = n / ( ( 1 + ( int ) Math . Sqrt ( 5 ) ) / 2.0 ) ; return ( int ) Math . Round ( a ) ; } static int nextFibonacci ( int n ) { double a = n * ( 1 + Math . Sqrt ( 5 ) ) / 2.0 ; return ( int ) Math . Round ( a ) ; } static bool isPerfectSquare ( int x ) { int s = ( int ) Math . Sqrt ( x ) ; return ( s * s == x ) ; } static bool isFibonacci ( int n ) { return ( isPerfectSquare ( 5 * n * n + 4 ) || isPerfectSquare ( 5 * n * n - 4 ) ) ; } static int countFibonacciPairs ( int [ ] arr , int n ) { int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) if ( isFibonacci ( arr [ i ] ) && isFibonacci ( arr [ j ] ) ) { int prevFib = previousFibonacci ( arr [ i ] ) ; int nextFib = nextFibonacci ( arr [ i ] ) ; if ( prevFib == arr [ j ] nextFib == arr [ j ] ) { res ++ ; } } return res ; } public static void Main ( String [ ] args ) { int [ ] a = { 3 , 5 , 8 , 11 } ; int n = a . Length ; Console . Write ( countFibonacciPairs ( a , n ) ) ; } }
Count all distinct pairs with product equal to K | C # program to count the number of pairs whose product is equal to K ; Function to count the number of pairs whose product is equal to K ; Pick all elements one by one ; Check if the product of this pair is equal to K ; Driver code
using System ; class GFG { static int countPairsWithProdK ( int [ ] arr , int n , int k ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) if ( arr [ i ] * arr [ j ] == k ) count ++ ; } return count ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 5 , 3 , 4 , 2 } ; int N = arr . Length ; int K = 3 ; Console . WriteLine ( countPairsWithProdK ( arr , N , K ) ) ; } }
Count all distinct pairs with product equal to K | C # program to count the number of pairs whose product is equal to K ; Function to count the number of pairs whose product is equal to K ; Initialize the count ; Initialize empty hashmap . ; Insert array elements to hashmap ; Checking if the index is a whole number and present in the hashmap ; Driver code
using System ; class GFG { static int MAX = 100000 ; static int countPairsWithProductK ( int [ ] arr , int n , int k ) { int count = 0 ; int i ; bool [ ] hashmap = new bool [ MAX ] ; for ( i = 0 ; i < n ; i ++ ) hashmap [ arr [ i ] ] = true ; for ( i = 0 ; i < n ; i ++ ) { int x = arr [ i ] ; double index = 1.0 * k / arr [ i ] ; if ( index >= 0 && ( ( index - ( int ) ( index ) ) == 0 ) && hashmap [ k / x ] ) count ++ ; hashmap [ x ] = false ; } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 5 , 3 , 4 , 2 } ; int N = arr . Length ; int K = 3 ; Console . Write ( countPairsWithProductK ( arr , N , K ) ) ; } }
Find any K distinct odd integers such that their sum is equal to N | C # implementation to find k odd integers such that their sum is N ; Function to find K odd integers such that their sum is N ; Condition to check if there exist such K integers ; Loop to find first K - 1 distinct odd integers ; Final Kth odd number ; Driver code
using System ; class GFG { static void oddints ( int n , int k ) { if ( n % 2 != k % 2 ) { Console . WriteLine ( " - 1" ) ; return ; } int sum = 0 ; int i = 1 ; int j = 1 ; while ( j < k ) { sum = sum + i ; Console . Write ( i + " ▁ " ) ; i = i + 2 ; j ++ ; } int finalOdd = n - sum ; Console . WriteLine ( finalOdd ) ; } public static void Main ( String [ ] args ) { int n = 10 ; int k = 2 ; oddints ( n , k ) ; } }
Generate an array of size N according to the given rules | C # implementation to generate an array of size N by following the given rules ; Function to search the most recent location of element N If not present in the array it will return - 1 ; Function to generate an array of size N by following the given rules ; Loop to fill the array as per the given rules ; Check for the occurrence of arr [ i - 1 ] ; Driver code
using System ; public class GFG { static int [ ] a ; static int search ( int [ ] a , int k , int x ) { int j ; for ( j = k - 1 ; j > - 1 ; j -- ) { if ( a [ j ] == x ) return j ; } return - 1 ; } static void genArray ( int [ ] arr , int N ) { for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( search ( arr , i , arr [ i ] ) == - 1 ) arr [ i + 1 ] = 0 ; else arr [ i + 1 ] = ( i - search ( arr , i , arr [ i ] ) ) ; } } public static void Main ( string [ ] args ) { int N = 5 ; int size = N + 1 ; int [ ] a = new int [ N ] ; genArray ( a , N ) ; for ( int i = 0 ; i < N ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; } }
Count of pairs in an Array whose sum is a Perfect Cube | C # implementation of the approach ; Function to return an List containing all the perfect cubes upto n ; while current perfect cube is less than or equal to n ; Function to print the sum of maximum two elements from the array ; Function to return the count of numbers that when added with n give a perfect cube ; temp > n is checked so that pairs ( x , y ) and ( y , x ) don 't get counted twice ; Function to count the pairs whose sum is a perfect cube ; Sum of the maximum two elements from the array ; List of perfect cubes upto max ; Contains all the array elements ; Add count of the elements that when added with arr [ i ] give a perfect cube ; Driver code
using System ; using System . Collections . Generic ; class GFG { static List < int > getPerfectcubes ( int n ) { List < int > perfectcubes = new List < int > ( ) ; int current = 1 ; int i = 1 ; while ( current <= n ) { perfectcubes . Add ( current ) ; i += 1 ; current = ( int ) ( Math . Pow ( i , 3 ) ) ; } return perfectcubes ; } static int maxPairSum ( int [ ] arr ) { int n = arr . Length ; int max = 0 ; int secondMax = 0 ; if ( arr [ 0 ] > arr [ 1 ] ) { max = arr [ 0 ] ; secondMax = arr [ 1 ] ; } else { max = arr [ 1 ] ; secondMax = arr [ 0 ] ; } for ( int i = 2 ; i < n ; i ++ ) { if ( arr [ i ] > max ) { secondMax = max ; max = arr [ i ] ; } else if ( arr [ i ] > secondMax ) { secondMax = arr [ i ] ; } } return ( max + secondMax ) ; } static int countPairsWith ( int n , List < int > perfectcubes , List < int > nums ) { int count = 0 ; for ( int i = 0 ; i < perfectcubes . Count ; i ++ ) { int temp = perfectcubes [ i ] - n ; if ( temp > n && ( nums . Contains ( temp ) ) ) count += 1 ; } return count ; } static int countPairs ( int [ ] arr ) { int n = arr . Length ; int max = maxPairSum ( arr ) ; List < int > perfectcubes = getPerfectcubes ( max ) ; List < int > nums = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { nums . Add ( arr [ i ] ) ; } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { count += countPairsWith ( arr [ i ] , perfectcubes , nums ) ; } return count ; } public static void Main ( String [ ] agrs ) { int [ ] arr = { 2 , 6 , 18 , 9 , 999 , 1 } ; Console . Write ( countPairs ( arr ) ) ; } }
Number of perfect cubes between two given numbers | A Simple Method to count cubes between a and b ; Function to count cubes between two numbers ; Traverse through all numbers ; Check if current number ' i ' is perfect cube ; Driver code
using System ; class GFG { static int countCubes ( int a , int b ) { for ( int i = a ; i <= b ; i ++ ) for ( int j = 1 ; j * j * j <= i ; j ++ ) if ( j * j * j == i ) cnt ++ ; return cnt ; } public static void Main ( ) { int a = 7 , b = 30 ; Console . Write ( " Count ▁ of ▁ Cubes ▁ is ▁ " + countCubes ( a , b ) ) ; } }
Number of perfect cubes between two given numbers | An Efficient Method to count cubes between a and b C # implementation of the above approach ; Function to count cubes between two numbers ; Driver code
using System ; class GFG { static int countCubes ( int a , int b ) { return ( int ) ( Math . Floor ( Math . Cbrt ( b ) ) - Math . Ceiling ( Math . Cbrt ( a ) ) + 1 ) ; } public static void Main ( string [ ] args ) { int a = 7 , b = 28 ; Console . WriteLine ( " Count ▁ of ▁ cubes ▁ is ▁ " + countCubes ( a , b ) ) ; } }
XOR and OR of all N | C # program to find the XOR and OR of all Armstrong numbers of N digits ; Function to check if a number is Armstrong or not ; Function to find XOR of all N - digits Armstrong number ; To store the XOR and OR of all Armstrong number ; Starting N - digit Armstrong number ; Ending N - digit Armstrong number ; Iterate over starting and ending number ; To check if i is Armstrong or not ; Print the XOR and OR of all Armstrong number ; Driver Code
using System ; class GFG { static bool isArmstrong ( int x , int n ) { int sum1 = 0 ; int temp = x ; while ( temp > 0 ) { int digit = temp % 10 ; sum1 += ( int ) Math . Pow ( digit , n ) ; temp /= 10 ; } return sum1 == x ; } static void CalculateXORandOR ( int n ) { int CalculateXOR = 0 ; int CalculateOR = 0 ; int start = ( int ) Math . Pow ( 10 , n - 1 ) ; int end = ( int ) ( Math . Pow ( 10 , n ) ) - 1 ; for ( int i = start ; i < end + 1 ; i ++ ) { if ( isArmstrong ( i , n ) ) { CalculateXOR = CalculateXOR ^ i ; CalculateOR = CalculateOR | i ; } } Console . WriteLine ( " XOR ▁ = ▁ " + CalculateXOR ) ; Console . WriteLine ( " OR ▁ = ▁ " + CalculateOR ) ; } public static void Main ( String [ ] args ) { int n = 4 ; CalculateXORandOR ( n ) ; } }
Perfect Cube | C # program to check whether the given number N is the perfect cube or not ; Function to check if a number is a perfect Cube or not ; Iterate from 1 - N ; Find the cube of every number ; Check if cube equals N or not ; Driver code ; Function call
using System ; class GFG { static void perfectCube ( int N ) { int cube ; for ( int i = 0 ; i <= N ; i ++ ) { cube = i * i * i ; if ( cube == N ) { Console . WriteLine ( " Yes " ) ; return ; } else if ( cube > N ) { Console . WriteLine ( " NO " ) ; return ; } } } public static void Main ( string [ ] args ) { int N = 216 ; perfectCube ( N ) ; } }
Perfect Cube | C # program to check whether the given number N is the perfect cube or not ; Function to check if a number is a perfect Cube using inbuilt function ; If cube of cube_root is equals to N , then print Yes Else print No ; Driver 's code ; Function call to check N is cube or not
using System ; class GFG { static void perfectCube ( int N ) { int cube_root ; cube_root = ( int ) Math . Round ( Math . Cbrt ( N ) ) ; if ( cube_root * cube_root * cube_root == N ) { Console . WriteLine ( " Yes " ) ; return ; } else { Console . WriteLine ( " NO " ) ; return ; } } public static void Main ( string [ ] args ) { int N = 125 ; perfectCube ( N ) ; } }
Check if given array can be made 0 with given operations performed any number of times | C # implementation of the approach ; Function to whether the array can be made zero or not ; Count for even elements ; Count for odd elements ; Traverse the array to count the even and odd ; If arr [ i ] is odd ; If arr [ i ] is even ; Check if count of even is zero or count of odd is zero ; Driver 's Code
using System ; class GFG { static void check ( int [ ] arr , int N ) { int even = 0 ; int odd = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 1 ) { odd ++ ; } else { even ++ ; } } if ( even == N odd == N ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 3 } ; int N = arr . Length ; check ( arr , N ) ; } }
Calculate sum of all integers from 1 to N , excluding perfect power of 2 | C # implementation of the above approach ; Function to find the required summation ; Find the sum of first N integers using the formula ; Find the sum of numbers which are exact power of 2 by using the formula ; Print the final Sum ; Driver Code ; Function to find the sum
using System ; class GFG { public static void findSum ( int N ) { int sum = ( N ) * ( N + 1 ) / 2 ; int r = ( int ) ( Math . Log ( N ) / Math . Log ( 2 ) ) + 1 ; int expSum = ( int ) ( Math . Pow ( 2 , r ) ) - 1 ; Console . Write ( sum - expSum ) ; } public static void Main ( string [ ] args ) { int N = 2 ; findSum ( N ) ; } }
Largest Even and Odd N | C # implementation of the above approach ; Function to print the largest N - digit even and odd numbers of base B ; Initialise the Number ; If Base B is even , then B ^ n will give largest Even number of N + 1 digit ; To get even number of N digit subtract 2 from B ^ n ; To get odd number of N digit subtract 1 from B ^ n ; If Base B is odd , then B ^ n will give largest Odd number of N + 1 digit ; To get even number of N digit subtract 1 from B ^ n ; To get odd number of N digit subtract 2 from B ^ n ; Driver 's Code ; Function to find the numbers
using System ; class GFG { static void findNumbers ( int n , int b ) { double even = 0 , odd = 0 ; if ( b % 2 == 0 ) { even = Math . Pow ( b , n ) - 2 ; odd = Math . Pow ( b , n ) - 1 ; } else { even = Math . Pow ( b , n ) - 1 ; odd = Math . Pow ( b , n ) - 2 ; } Console . WriteLine ( " Even ▁ Number ▁ = ▁ " + ( int ) even ) ; Console . Write ( " Odd ▁ Number ▁ = ▁ " + ( int ) odd ) ; } public static void Main ( String [ ] args ) { int N = 2 , B = 5 ; findNumbers ( N , B ) ; } }
Minimum divisor of a number to make the number perfect cube | C # program to find minimum number which divide n to make it a perfect cube ; Returns the minimum divisor ; Since 2 is only even prime , compute its power seprately . ; If count is not divisible by 3 , it must be removed by dividing n by prime number power . ; If count is not divisible by 3 , it must be removed by dividing n by prime number power . ; if n is a prime number ; Driver code
using System ; class GFG { static int findMinNumber ( int n ) { int count = 0 , ans = 1 ; while ( n % 2 == 0 ) { count ++ ; n /= 2 ; } if ( count % 3 != 0 ) ans *= ( int ) Math . Pow ( 2 , ( count % 3 ) ) ; for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i += 2 ) { count = 0 ; while ( n % i == 0 ) { count ++ ; n /= i ; } if ( count % 3 != 0 ) ans *= ( int ) Math . Pow ( i , ( count % 3 ) ) ; } if ( n > 2 ) ans *= n ; return ans ; } public static void Main ( String [ ] args ) { int n = 128 ; Console . Write ( findMinNumber ( n ) + " STRNEWLINE " ) ; } }
Check whether the number can be made perfect square after adding K | C # program to check whether the number can be made perfect square after adding K ; Function to check whether the number can be made perfect square after adding K ; Computing the square root of the number ; Print Yes if the number is a perfect square ; Driver code
using System ; class GFG { static void isPerfectSquare ( int x ) { int sr = ( int ) Math . Sqrt ( x ) ; if ( sr * sr == x ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( String [ ] args ) { int n = 7 ; int k = 2 ; isPerfectSquare ( n + k ) ; } }
Number of times the largest Perfect Cube can be subtracted from N | C # implementation of the approach ; Function to return the count of steps ; Variable to store the count of steps ; Iterate while N > 0 ; Get the largest perfect cube and subtract it from N ; Increment steps ; Return the required count ; Driver code
using System ; class GFG { static int countSteps ( int n ) { int steps = 0 ; while ( n > 0 ) { int largest = ( int ) Math . Pow ( n , ( double ) 1 / 3 ) ; n -= ( largest * largest * largest ) ; steps ++ ; } return steps ; } public static void Main ( String [ ] args ) { int n = 150 ; Console . Write ( countSteps ( n ) ) ; } }
Product of all Subsets of a set formed by first N natural numbers | C # implementation of the approach ; Function to find the product of all elements in all subsets in natural numbers from 1 to N ; Driver Code
using System ; class GFG { static int product ( int N ) { int ans = 1 ; int val = ( int ) Math . Pow ( 2 , N - 1 ) ; for ( int i = 1 ; i <= N ; i ++ ) { ans *= ( int ) Math . Pow ( i , val ) ; } return ans ; } public static void Main ( string [ ] args ) { int N = 2 ; Console . WriteLine ( product ( N ) ) ; } }
Radii of the three tangent circles of equal radius which are inscribed within a circle of given radius | C # program to find the radii of the three tangent circles of equal radius when the radius of the circumscribed circle is given ; Driver code
using System ; class GFG { static void threetangcircle ( int R ) { Console . WriteLine ( " The ▁ radii ▁ of ▁ the ▁ tangent ▁ circles ▁ is ▁ " + 0.4645 * R ) ; } public static void Main ( ) { int R = 4 ; threetangcircle ( R ) ; } }