codeparrot/xlcost-text-to-code huggingface dataset:
Absolute difference between the count of odd and even factors of N | C # program for the above approach ; Function to find the smallest prime factor of all the numbers using Sieve Of Eratosthenes ; Stores whether any number is prime or not ; Initialize smallest factor as 2 for all the even numbers ; Iterate over the range [ 3 , N ] ; If i is prime ; Iterate all multiples of i ; i is the smallest prime factor of i * j ; Function to find the absolute difference between the count of odd and even factors of N ; Stores the smallest prime factor of i ; Fill values in s [ ] using sieve of eratosthenes ; Stores the total number of factors and the total number of odd and even factors ; Store the current prime factor of the number N ; Store the power of current prime factor ; Loop while N is greater than 1 ; If N also has smallest prime factor as curr , then increment cnt by 1 ; Update only total number of factors if curr is 2 ; Update total number of factors and total number of odd factors ; Update current prime factor as s [ N ] and count as 1 ; Calculate the number of even factors ; Print the difference ; Driver Code
using System ; class GFG { static void sieveOfEratosthenes ( int N , int [ ] s ) { bool [ ] prime = new bool [ N + 1 ] ; for ( int i = 2 ; i <= N ; i += 2 ) s [ i ] = 2 ; for ( int i = 3 ; i <= N ; i += 2 ) { if ( prime [ i ] == false ) { s [ i ] = i ; for ( int j = i ; j * i <= N ; j += 2 ) { if ( ! prime [ i * j ] ) { prime [ i * j ] = true ; s [ i * j ] = i ; } } } } } static void findDifference ( int N ) { int [ ] s = new int [ N + 1 ] ; sieveOfEratosthenes ( N , s ) ; int total = 1 , odd = 1 , even = 0 ; int curr = s [ N ] ; int cnt = 1 ; while ( N > 1 ) { N /= s [ N ] ; if ( curr == s [ N ] ) { cnt ++ ; continue ; } if ( curr == 2 ) { total = total * ( cnt + 1 ) ; } else { total = total * ( cnt + 1 ) ; odd = odd * ( cnt + 1 ) ; } curr = s [ N ] ; cnt = 1 ; } even = total - odd ; Console . Write ( Math . Abs ( even - odd ) ) ; } public static void Main ( ) { int N = 12 ; findDifference ( N ) ; } }
Calculate Median from given values of Mean and Mode | C # program for the above approach ; Function to find the median of a group of data with given mean and mode ; Calculate the median ; Print the median ; Driver Code
using System ; class GFG { static void findMedian ( int Mean , int Mode ) { double Median = ( 2 * Mean + Mode ) / 3.0 ; Console . Write ( Median ) ; } public static void Main ( ) { int mode = 6 , mean = 3 ; findMedian ( mean , mode ) ; } }
Program to find the Magnitude of a Vector | C # program for the above approach ; Function to calculate magnitude of a 3 dimensional vector ; Stores the sum of squares of coordinates of a vector ; Return the magnitude ; Driver code
using System ; class GFG { private static double vectorMagnitude ( int x , int y , int z ) { int sum = x * x + y * y + z * z ; return Math . Sqrt ( sum ) ; } static void Main ( ) { int x = 1 ; int y = 2 ; int z = 3 ; Console . Write ( vectorMagnitude ( x , y , z ) ) ; } }
Program to find the product of a number with a Mersenne Number | C # program for the above approach ; Function to find prodcut of a Mersenne number with another number ; Stores the power of 2 of integer M + 1 ; Return the product ; Driver Code
using System ; class GFG { static int multiplyByMersenne ( int N , int M ) { int x = ( int ) ( Math . Log ( M + 1 ) / Math . Log ( 2 ) ) ; return ( ( N << x ) - N ) ; } static public void Main ( ) { int N = 4 ; int M = 15 ; Console . Write ( multiplyByMersenne ( N , M ) ) ; } }
Nearest power of 2 of nearest perfect squares of non | C # program for the above approach ; Function to find nearest perfect square of num ; Calculate square root of num ; Calculate perfect square ; Find the nearest perfect square ; Function to find the power of 2 nearest to the number num ; Calculate log base 2 of num ; Highest power of 2 which is <= num ; Function to find the nearest perfect square and the nearest power of 2 of every array element whose occurrence is 1 ; Stores frequency of array elements ; Traverse the array and update frequency of current array element ; Traverse the map freq ; If the frequency is 1 ; Find nearest perfect square ; Print the nearest power of 2 ; If the any does not contain any non - repeating elements ; Driver Code
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int perfectSquare ( int num ) { int sr = ( int ) ( Math . Sqrt ( num ) ) ; int a = sr * sr ; int b = ( sr + 1 ) * ( sr + 1 ) ; if ( ( num - a ) < ( b - num ) ) { return a ; } else { return b ; } } static int powerOfTwo ( int num ) { int lg = ( int ) ( Math . Log ( num ) / Math . Log ( 2 ) ) ; int p = ( int ) ( Math . Pow ( 2 , lg ) ) ; return p ; } static void uniqueElement ( int [ ] arr , int N ) { bool ans = true ; Dictionary < int , int > freq = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( freq . ContainsKey ( arr [ i ] ) ) { freq [ arr [ i ] ] = freq [ arr [ i ] ] + 1 ; } else { freq [ arr [ i ] ] = 1 ; } } foreach ( var el in freq . OrderBy ( el => el . Key ) ) { if ( el . Value == 1 ) { ans = false ; int ps = perfectSquare ( el . Key ) ; Console . Write ( powerOfTwo ( ps ) + " ▁ " ) ; } } if ( ans ) Console . Write ( " - 1" ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 4 , 11 , 4 , 3 , 4 } ; int N = arr . Length ; uniqueElement ( arr , N ) ; } }
Partition array into two subarrays with every element in the right subarray strictly greater than every element in left subarray | C # program of the above approach ; Function to partition the array into two non - empty subarrays which satisfies the given condition ; Stores the suffix min array ; Stores the minimum of a suffix ; Traverse the array in reverse ; Update minimum ; Store the minimum ; Stores the maximum value of a prefix ; Stores the index of the partition ; Update max ; If max is less than min [ i + 1 ] ; Store the index of partition ; break ; If ind is not - 1 ; Print the first subarray ; Print the second subarray ; Otherwise ; Driver Code
using System ; class GFG { static void partitionArray ( int [ ] a , int n ) { int [ ] min = new int [ n ] ; int mini = Int32 . MaxValue ; for ( int i = n - 1 ; i >= 0 ; i -- ) { mini = Math . Min ( mini , a [ i ] ) ; min [ i ] = mini ; } int maxi = Int32 . MinValue ; int ind = - 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { maxi = Math . Max ( maxi , a [ i ] ) ; if ( maxi < min [ i + 1 ] ) { ind = i ; break ; } } if ( ind != - 1 ) { for ( int i = 0 ; i <= ind ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; for ( int i = ind + 1 ; i < n ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; } else Console . Write ( " Impossible " ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 5 , 3 , 2 , 7 , 9 } ; int N = arr . Length ; partitionArray ( arr , N ) ; } }
Check if a number can be represented as sum of K positive integers out of which at least K | C # program for above approach ; Function to count all prime factors of a given number ; Count the number of 2 s that divides n ; Since n is odd at this point , skip one element ; While i divides n , count i and divide n ; If n is a prime number greater than 2 ; Function to find the sum of first n nearly prime numbers ; Store the required sum ; Add this number if it is satisfies the condition ; Increment count of nearly prime numbers ; Function to check if N can be represented as sum of K different positive integers out of which at least K - 1 of them are nearly prime ; Store the sum of first K - 1 nearly prime numbers ; If sum is greater than or equal to n ; Otherwise , print Yes ; Driver code
using System ; public class GFG { static int countPrimeFactors ( int n ) { int count = 0 ; while ( n % 2 == 0 ) { n = n / 2 ; count ++ ; } for ( int i = 3 ; i <= ( int ) Math . Sqrt ( n ) ; i = i + 2 ) { while ( n % i == 0 ) { n = n / i ; count ++ ; } } if ( n > 2 ) count ++ ; return ( count ) ; } static int findSum ( int n ) { int sum = 0 ; for ( int i = 1 , num = 2 ; i <= n ; num ++ ) { if ( countPrimeFactors ( num ) == 2 ) { sum += num ; i ++ ; } } return sum ; } static void check ( int n , int k ) { int s = findSum ( k - 1 ) ; if ( s >= n ) Console . WriteLine ( " No " ) ; else Console . WriteLine ( " Yes " ) ; } public static void Main ( String [ ] args ) { int n = 100 , k = 6 ; check ( n , k ) ; } }
Count ways to represent an integer as an exponent | C # program for the above approach ; Function to calculate GCD of a and b using Euclidean Algorithm ; Iterate until b is non - zero ; Return the GCD ; Function to count the number of ways N can be expressed as x ^ y ; Base Case ; Stores the gcd of powers ; Calculate the degree of 2 in N ; Calculate the degree of prime numbers in N ; Calculate the degree of prime ' i ' in N ; If N is a prime , g becomes 1. ; Stores the number of ways to represent N as x ^ y ; Find the number of Factors of g ; Update the count of ways ; Iterate to find rest of the prime numbers ; Find the power of i ; Update the count of ways ; If g is prime ; Return the total number of ways ; Driver Code
using System ; public class GFG { static int gcd ( int a , int b ) { while ( b > 0 ) { int rem = a % b ; a = b ; b = rem ; } return a ; } static int countNumberOfWays ( int n ) { if ( n == 1 ) return - 1 ; int g = 0 ; int power = 0 ; while ( n % 2 == 0 ) { power ++ ; n /= 2 ; } g = gcd ( g , power ) ; for ( int i = 3 ; i <= ( int ) Math . Sqrt ( n ) ; i += 2 ) { power = 0 ; while ( n % i == 0 ) { power ++ ; n /= i ; } g = gcd ( g , power ) ; } if ( n > 2 ) g = gcd ( g , 1 ) ; int ways = 1 ; power = 0 ; while ( g % 2 == 0 ) { g /= 2 ; power ++ ; } ways *= ( power + 1 ) ; for ( int i = 3 ; i <= ( int ) Math . Sqrt ( g ) ; i += 2 ) { power = 0 ; while ( g % i == 0 ) { power ++ ; g /= i ; } ways *= ( power + 1 ) ; } if ( g > 2 ) ways *= 2 ; return ways ; } public static void Main ( String [ ] args ) { int N = 64 ; Console . Write ( countNumberOfWays ( N ) ) ; } }
Highest power of 2 less than or equal to given Integer | C # implementation of the above approach ; Function to return the lowest power of 2 close to given positive number ; Floor function is used to determine the value close to the number ; Function to return the lowest power of 2 close to given negative number ; Ceil function is used for negative numbers as - 1 > - 4. It would be opposite to positive numbers where 1 < 4 ; Function to find the highest power of 2 ; To check if the given number is positive or negative ; If the number is negative , then the ceil of the positive number is calculated and negative sign is added ; Driver code
using System ; class GFG { static int powOfPositive ( int n ) { int pos = ( int ) Math . Floor ( ( Math . Log ( n ) / Math . Log ( 2 ) ) ) ; return ( int ) Math . Pow ( 2 , pos ) ; } static int powOfNegative ( int n ) { int pos = ( int ) Math . Ceiling ( ( Math . Log ( n ) / Math . Log ( 2 ) ) ) ; return ( int ) ( - 1 * Math . Pow ( 2 , pos ) ) ; } static void highestPowerOf2 ( int n ) { if ( n > 0 ) { Console . WriteLine ( powOfPositive ( n ) ) ; } else { n = - n ; Console . WriteLine ( powOfNegative ( n ) ) ; } } public static void Main ( ) { int n = - 24 ; highestPowerOf2 ( n ) ; } }
Number of cards needed build a House of Cards of a given level N | C # implementation of the above approach ; Function to find number of cards needed ; Driver Code
using System ; class GFG { public static int noOfCards ( int n ) { return n * ( 3 * n + 1 ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . Write ( noOfCards ( n ) ) ; } }
Find smallest possible Number from a given large Number with same count of digits | C # implementation of the above approach ; Function for finding the smallest possible number after swapping the digits any number of times ; Variable to store the readonly answer ; Array to store the count of occurrence of each digit ; Loop to calculate the number of occurrences of every digit ; Loop to get smallest number ; Returning the answer ; Driver code
using System ; class GFG { static String smallestPoss ( String s , int n ) { String ans = " " ; int [ ] arr = new int [ 10 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ s [ i ] - 48 ] ++ ; } for ( int i = 0 ; i < 10 ; i ++ ) { for ( int j = 0 ; j < arr [ i ] ; j ++ ) ans = ans + String . Join ( " " , i ) ; } return ans ; } public static void Main ( String [ ] args ) { int N = 15 ; String K = "325343273113434" ; Console . Write ( smallestPoss ( K , N ) ) ; } }
Count the subarray with sum strictly greater than the sum of remaining elements | C # implementation of the above approach ; Function to count the number of sub - arrays with sum strictly greater than the remaining elements of array ; For loop for beginning point of a subarray ; For loop for ending point of the subarray ; Initialise subarray_sum and remaining_sum to 0 ; For loop to calculate the sum of generated subarray ; For loop to calculate the sum remaining array element ; Checking for condition when subarray sum is strictly greater than remaining sum of array element ; Driver code
using System ; class GFG { static int Count_subarray ( int [ ] arr , int n ) { int subarray_sum , remaining_sum , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { subarray_sum = 0 ; remaining_sum = 0 ; for ( int k = i ; k <= j ; k ++ ) { subarray_sum += arr [ k ] ; } for ( int l = 0 ; l < i ; l ++ ) { remaining_sum += arr [ l ] ; } for ( int l = j + 1 ; l < n ; l ++ ) { remaining_sum += arr [ l ] ; } if ( subarray_sum > remaining_sum ) { count += 1 ; } } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 10 , 9 , 12 , 6 } ; int n = arr . Length ; Console . Write ( Count_subarray ( arr , n ) ) ; } }
Count the subarray with sum strictly greater than the sum of remaining elements | C # implementation of the above approach ; Calculating total sum of given array ; For loop for beginning point of a subarray ; initialise subarray_sum to 0 ; For loop for calculating subarray_sum and remaining_sum ; Calculating subarray_sum and corresponding remaining_sum ; Checking for the condition when subarray sum is strictly greater than the remaining sum of the array element ; Driver code
using System ; class GFG { static int Count_subarray ( int [ ] arr , int n ) { int total_sum = 0 , subarray_sum , remaining_sum , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { total_sum += arr [ i ] ; } for ( int i = 0 ; i < n ; i ++ ) { subarray_sum = 0 ; for ( int j = i ; j < n ; j ++ ) { subarray_sum += arr [ j ] ; remaining_sum = total_sum - subarray_sum ; if ( subarray_sum > remaining_sum ) { count += 1 ; } } } return count ; } public static void Main ( ) { int [ ] arr = { 10 , 9 , 12 , 6 } ; int n = arr . Length ; Console . WriteLine ( Count_subarray ( arr , n ) ) ; } }
Remove one element to get maximum XOR | C # implementation of the approach ; Function to return the maximized XOR after removing an element from the array ; Find XOR of the complete array ; To store the readonly answer ; Iterating through the array to find the readonly answer ; Return the readonly answer ; Driver code
using System ; class GFG { static int maxXOR ( int [ ] arr , int n ) { int xorArr = 0 ; for ( int i = 0 ; i < n ; i ++ ) xorArr ^= arr [ i ] ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) ans = Math . Max ( ans , ( xorArr ^ arr [ i ] ) ) ; return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 3 } ; int n = arr . Length ; Console . WriteLine ( maxXOR ( arr , n ) ) ; } }
Count of numbers from the range [ L , R ] which contains at least one digit that divides K | C # implementation of the approach ; Function that returns true if num contains at least one digit that divides k ; Get the last digit ; If the digit is non - zero and it divides k ; Remove the last digit ; There is no digit in num that divides k ; Function to return the required count of elements from the given range which contain at least one digit that divides k ; To store the result ; For every number from the range ; If any digit of the current number divides k ; Driver code
using System ; class GFG { static bool digitDividesK ( int num , int k ) { while ( num != 0 ) { int d = num % 10 ; if ( d != 0 && k % d == 0 ) return true ; num = num / 10 ; } return false ; } static int findCount ( int l , int r , int k ) { int count = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( digitDividesK ( i , k ) ) count ++ ; } return count ; } public static void Main ( ) { int l = 20 , r = 35 ; int k = 45 ; Console . WriteLine ( findCount ( l , r , k ) ) ; } }
Check if a given number is factorial of any number | C # implementation for the above approach ; Function to check if the given number is a factorial of any number ; Driver Code
using System ; class GFG { static Boolean isFactorial ( int n ) { for ( int i = 1 ; ; i ++ ) { if ( n % i == 0 ) { n /= i ; } else { break ; } } if ( n == 1 ) { return true ; } else { return false ; } } public static void Main ( String [ ] args ) { int n = 24 ; Boolean ans = isFactorial ( n ) ; if ( ans == true ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }
Remove an element to minimize the LCM of the given array | C # implementation of the above approach ; Function to return the LCM of two numbers ; Function to return the minimum LCM after removing a single element from the given array ; Prefix and Suffix arrays ; Single state dynamic programming relation for storing LCM of first i elements from the left in Prefix [ i ] ; Initializing Suffix array ; Single state dynamic programming relation for storing LCM of all the elements having index greater than or equal to i in Suffix [ i ] ; If first or last element of the array has to be removed ; If any other element is replaced ; Return the minimum LCM ; Driver code
using System ; class GFG { static int lcm ( int a , int b ) { int GCD = __gcd ( a , b ) ; return ( a * b ) / GCD ; } static int MinLCM ( int [ ] a , int n ) { int [ ] Prefix = new int [ n + 2 ] ; int [ ] Suffix = new int [ n + 2 ] ; Prefix [ 1 ] = a [ 0 ] ; for ( int i = 2 ; i <= n ; i += 1 ) { Prefix [ i ] = lcm ( Prefix [ i - 1 ] , a [ i - 1 ] ) ; } Suffix [ n ] = a [ n - 1 ] ; for ( int i = n - 1 ; i >= 1 ; i -= 1 ) { Suffix [ i ] = lcm ( Suffix [ i + 1 ] , a [ i - 1 ] ) ; } int ans = Math . Min ( Suffix [ 2 ] , Prefix [ n - 1 ] ) ; for ( int i = 2 ; i < n ; i += 1 ) { ans = Math . Min ( ans , lcm ( Prefix [ i - 1 ] , Suffix [ i + 1 ] ) ) ; } return ans ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int [ ] a = { 5 , 15 , 9 , 36 } ; int n = a . Length ; Console . WriteLine ( MinLCM ( a , n ) ) ; } }
Number of coloured 0 's in an N | C # implementation of the approach ; Function to return the count of coloured 0 s in an n - level hexagon ; Driver code
using System ; class GFG { static int count ( int n ) { return n * ( 3 * n - 1 ) / 2 ; } public static void Main ( String [ ] args ) { int n = 3 ; Console . WriteLine ( count ( n ) ) ; } }
Minimum value to be assigned to the elements so that sum becomes greater than initial sum | C # implementation of the above approach ; Function to return the minimum required value ; Find the sum of the array elements ; Return the required value ; Driver code
using System ; class GFG { static int findMinValue ( int [ ] arr , int n ) { long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; return ( ( int ) ( sum / n ) + 1 ) ; } static public void Main ( ) { int [ ] arr = { 4 , 2 , 1 , 10 , 6 } ; int n = arr . Length ; Console . WriteLine ( findMinValue ( arr , n ) ) ; } }
Color all boxes in line such that every M consecutive boxes are unique | C # implementation of the above approach ; Function to return ( m ! % MOD ) ; Driver code
using System ; class GFG { const int MOD = 1000000007 ; static int modFact ( int n , int m ) { int result = 1 ; for ( int i = 1 ; i <= m ; i ++ ) result = ( result * i ) % MOD ; return result ; } public static void Main ( ) { int n = 3 , m = 2 ; Console . WriteLine ( modFact ( n , m ) ) ; } }
Sum of squares of all Subsets of given Array | C # implementation of the approach ; Function to return ( 2 ^ P % mod ) ; Function to return the sum of squares of subsets ; Sqauaring the elements and adding it to ans ; Driver code
using System ; class GFG { static readonly int mod = ( int ) ( 1e9 + 7 ) ; static long power ( int p ) { long res = 1 ; for ( int i = 1 ; i <= p ; ++ i ) { res *= 2 ; res %= mod ; } return res % mod ; } static long subset_square_sum ( int [ ] A ) { int n = A . Length ; long ans = 0 ; foreach ( int i in A ) { ans += ( 1 * i * i ) % mod ; ans %= mod ; } return ( 1 * ans * power ( n - 1 ) ) % mod ; } public static void Main ( String [ ] args ) { int [ ] A = { 3 , 7 } ; Console . WriteLine ( subset_square_sum ( A ) ) ; } }
Find the number of pairs such that their gcd is equals to 1 | C # program to find the number of pairs such that gcd equals to 1 ; Function to calculate least prime factor of each number ; If it is a prime number ; For all multiples which are not visited yet . ; Function to find the value of Mobius function for all the numbers from 1 to n ; If number is one ; If number has a squared prime factor ; Multiply - 1 with the previous number ; Function to find the number of pairs such that gcd equals to 1 ; To store maximum number ; To store frequency of each number ; Find frequency and maximum number ; To store number of pairs with gcd equals to 1 ; Traverse through the all possible elements ; Return the number of pairs ; Driver code ; Function call
using System ; class GFG { static int N = 100050 ; static int [ ] lpf = new int [ N ] ; static int [ ] mobius = new int [ N ] ; static void least_prime_factor ( ) { for ( int i = 2 ; i < N ; i ++ ) if ( lpf [ i ] == 0 ) for ( int j = i ; j < N ; j += i ) if ( lpf [ j ] == 0 ) lpf [ j ] = i ; } static void Mobius ( ) { for ( int i = 1 ; i < N ; i ++ ) { if ( i == 1 ) mobius [ i ] = 1 ; else { if ( lpf [ i / lpf [ i ] ] == lpf [ i ] ) mobius [ i ] = 0 ; else mobius [ i ] = - 1 * mobius [ i / lpf [ i ] ] ; } } } static int gcd_pairs ( int [ ] a , int n ) { int maxi = 0 ; int [ ] fre = new int [ N ] ; for ( int i = 0 ; i < n ; i ++ ) { fre [ a [ i ] ] ++ ; maxi = Math . Max ( a [ i ] , maxi ) ; } least_prime_factor ( ) ; Mobius ( ) ; int ans = 0 ; for ( int i = 1 ; i <= maxi ; i ++ ) { if ( mobius [ i ] == 0 ) continue ; int temp = 0 ; for ( int j = i ; j <= maxi ; j += i ) temp += fre [ j ] ; ans += temp * ( temp - 1 ) / 2 * mobius [ i ] ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 2 , 3 , 4 , 5 , 6 } ; int n = a . Length ; Console . Write ( gcd_pairs ( a , n ) ) ; } }
Comparing X ^ Y and Y ^ X for very large values of X and Y | C # implementation of the approach ; Function to compare x ^ y and y ^ x ; Storing values OF x ^ y AND y ^ x ; Comparing values ; Driver code
using System ; class GFG { static void compareVal ( double x , double y ) { double a = y * Math . Log ( x ) ; double b = x * Math . Log ( y ) ; if ( a > b ) Console . Write ( x + " ^ " + y + " ▁ > ▁ " + y + " ^ " + x ) ; else if ( a < b ) Console . Write ( x + " ^ " + y + " ▁ < ▁ " + y + " ^ " + x ) ; else if ( a == b ) Console . Write ( x + " ^ " + y + " ▁ = ▁ " + y + " ^ " + x ) ; } static public void Main ( ) { double x = 4 , y = 5 ; compareVal ( x , y ) ; } }