codeparrot/xlcost-text-to-code huggingface dataset:
Count all prime numbers in a given range whose sum of digits is also prime | C # program for the above approach ; Create an array for storing primes ; Create a prefix array that will contain whether sum is prime or not ; Function to find primes in the range and check whether the sum of digits of a prime number is prime or not ; Initialise Prime array arr [ ] ; Since 0 and 1 are not prime numbers we mark them as '0' ; Using Sieve Of Eratosthenes ; if the number is prime ; Mark all the multiples of i starting from square of i with '0' ie . composite ; '0' represents not prime ; Initialise a sum variable as 0 ; Check if the number is prime ; A temporary variable to store the number ; Loop to calculate the sum of digits ; Check if the sum of prime number is prime ; if prime mark 1 ; If not prime mark 0 ; computing prefix array ; Function to count the prime numbers in the range [ L , R ] ; Function Call to find primes ; Print the result ; Driver Code ; Input range ; Function Call
using System ; class GFG { static int maxN = 1000000 ; static int [ ] arr = new int [ 1000001 ] ; static int [ ] prefix = new int [ 1000001 ] ; static void findPrimes ( ) { for ( int i = 1 ; i <= maxN ; i ++ ) arr [ i ] = 1 ; arr [ 0 ] = 0 ; arr [ 1 ] = 0 ; for ( int i = 2 ; i * i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) { for ( int j = i * i ; j <= maxN ; j += i ) { arr [ j ] = 0 ; } } } int sum = 0 ; prefix [ 0 ] = 0 ; for ( int i = 1 ; i <= maxN ; i ++ ) { if ( arr [ i ] == 1 ) { int temp = i ; sum = 0 ; while ( temp > 0 ) { int x = temp % 10 ; sum += x ; temp = temp / 10 ; if ( arr [ sum ] == 1 ) { prefix [ i ] = 1 ; } else { prefix [ i ] = 0 ; } } } } for ( int i = 1 ; i <= maxN ; i ++ ) { prefix [ i ] += prefix [ i - 1 ] ; } } static void countNumbersInRange ( int l , int r ) { findPrimes ( ) ; int result = prefix [ r ] - prefix [ l - 1 ] ; Console . Write ( result + " STRNEWLINE " ) ; } public static void Main ( ) { int l , r ; l = 5 ; r = 20 ; countNumbersInRange ( l , r ) ; } }
Find the concentration of a solution using given Mass and Volume | C # program to find concentration of a solution using given Mass and Volume ; Function to calculate concentration from the given mass of solute and volume of a solution ; Driver code
using System ; class GFG { static double get_concentration ( double mass , double volume ) { if ( volume == 0 ) return - 1 ; else return ( mass / volume ) * 1000 ; } public static void Main ( ) { double mass , volume ; mass = 100.00 ; volume = 500.00 ; Console . Write ( get_concentration ( mass , volume ) ) ; } }
Practical Numbers | C # program to check if a number is Practical or not . ; Returns true if there is a subset of set [ ] with sun equal to given sum ; The value of subset [ i , j ] will be true if there is a subset of set [ 0. . j - 1 ] with sum equal to i ; If sum is 0 , then answer is true ; If sum is not 0 and set is empty , then answer is false ; Fill the subset table in bottom up manner ; Function to store divisors of N in a vector ; Find all divisors which divides ' num ' ; if ' i ' is divisor of ' n ' ; if both divisors are same then store it once else store both divisors ; Returns true if num is Practical ; vector to store all divisors of N ; to check all numbers from 1 to < N ; Driver code
using System ; using System . Collections . Generic ; class GFG { static bool isSubsetSum ( List < int > set , int n , int sum ) { bool [ , ] subset = new bool [ n + 1 , sum + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) subset [ i , 0 ] = true ; for ( int i = 1 ; i <= sum ; i ++ ) subset [ 0 , i ] = false ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= sum ; j ++ ) { if ( j < set [ i - 1 ] ) subset [ i , j ] = subset [ i - 1 , j ] ; if ( j >= set [ i - 1 ] ) subset [ i , j ] = subset [ i - 1 , j ] || subset [ i - 1 , j - set [ i - 1 ] ] ; } } return subset [ n , sum ] ; } static void storeDivisors ( int n , List < int > div ) { for ( int i = 1 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) div . Add ( i ) ; else { div . Add ( i ) ; div . Add ( n / i ) ; } } } } static bool isPractical ( int N ) { List < int > div = new List < int > ( ) ; storeDivisors ( N , div ) ; for ( int i = 1 ; i < N ; i ++ ) { if ( ! isSubsetSum ( div , div . Count , i ) ) return false ; } return true ; } public static void Main ( String [ ] args ) { int N = 18 ; if ( isPractical ( N ) == true ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Super Niven Numbers | C # implementation to check if a number is Super Niven Number or not . ; Checks if sums of all subsets of digits array divides the number N ; to calculate length of array arr ; There are totoal 2 ^ n subsets ; Consider all numbers from 0 to 2 ^ n - 1 ; Consider binary representation of current i to decide which elements to pick . ; check sum of picked elements . ; Function to check if a number is a super - niven number ; to stor digits of N ; Driver code
using System ; using System . Collections . Generic ; class GFG { static bool isDivBySubsetSums ( List < int > arr , int num ) { int n = arr . Count ; long total = 1 << n ; for ( long i = 0 ; i < total ; i ++ ) { long sum = 0 ; for ( int j = 0 ; j < n ; j ++ ) if ( ( i & ( 1 << j ) ) > 0 ) sum += arr [ j ] ; if ( sum != 0 && num % sum != 0 ) return false ; } return true ; } static bool isSuperNivenNum ( int n ) { int temp = n ; List < int > digits = new List < int > ( ) ; while ( n != 0 ) { int digit = n % 10 ; digits . Add ( digit ) ; n = n / 10 ; } return isDivBySubsetSums ( digits , temp ) ; } public static void Main ( String [ ] args ) { int n = 500 ; if ( isSuperNivenNum ( n ) ) Console . Write ( " yes " ) ; else Console . Write ( " No " ) ; } }
Highly Composite Numbers | C # implementation for checking Highly Composite Number ; Function to count the number of divisors of the N ; sieve method for prime calculation ; Traversing through all prime numbers ; calculate number of divisor with formula total div = ( p1 + 1 ) * ( p2 + 1 ) * ... . . * ( pn + 1 ) where n = ( a1 ^ p1 ) * ( a2 ^ p2 ) . ... * ( an ^ pn ) ai being prime divisor for n and pi are their respective power in factorization ; Function to check if a number is a highly composite number ; count number of factors of N ; loop to count number of factors of every number less than N ; If any number less than N has more factors than N , then return false ; Driver code ; Given Number N ; Function Call
using System ; class GFG { static int divCount ( int n ) { bool [ ] hash = new bool [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) hash [ i ] = true ; for ( int p = 2 ; p * p < n ; p ++ ) if ( hash [ p ] == true ) for ( int i = p * 2 ; i < n ; i += p ) hash [ i ] = false ; int total = 1 ; for ( int p = 2 ; p <= n ; p ++ ) { if ( hash [ p ] ) { int count = 0 ; if ( n % p == 0 ) { while ( n % p == 0 ) { n = n / p ; count ++ ; } total = total * ( count + 1 ) ; } } } return total ; } static bool isHighlyCompositeNumber ( int N ) { int NdivCount = divCount ( N ) ; for ( int i = 1 ; i < N ; i ++ ) { int idivCount = divCount ( i ) ; if ( idivCount >= NdivCount ) return false ; } return true ; } public static void Main ( String [ ] args ) { int N = 12 ; if ( isHighlyCompositeNumber ( N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Pentacontahenagon Number | C # program for the above approach ; Function to find the N - th Pentacontahenagon Number ; Driver Code ; Function Call
using System ; class GFG { static int PentacontahenagonNum ( int N ) { return ( 49 * N * N - 47 * N ) / 2 ; } public static void Main ( ) { int N = 3 ; Console . Write ( "3rd ▁ Pentacontahenagon ▁ Number ▁ is ▁ " + PentacontahenagonNum ( N ) ) ; } }
Saint | C # program for above approach ; Function to check if a number is a Saint - Exupery number ; Considering triplets in sorted order . The value of first element in sorted triplet can be at - most n / 3. ; The value of second element must be less than equal to n / 2 ; Driver Code ; Given Number N ; Function Call
using System ; class GFG { static bool isSaintExuperyNum ( int n ) { for ( int i = 1 ; i <= n / 3 ; i ++ ) { for ( int j = i + 1 ; j <= n / 2 ; j ++ ) { int k = n / i / j ; if ( i * i + j * j == k * k ) { if ( i * j * k == n ) return true ; } } } return false ; } public static void Main ( ) { int N = 60 ; if ( isSaintExuperyNum ( N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Repdigit Numbers | C # implementation to check if a number is Repdigit ; Function to check if a number is a Repdigit number ; To store previous digit ( Assigning initial value which is less than any digit ) ; Traverse all digits from right to left and check if any digit is smaller than previous . ; Driver code
using System ; class GFG { static bool isRepdigit ( int num , int b ) { int prev = - 1 ; while ( num != 0 ) { int digit = num % b ; num /= b ; if ( prev != - 1 && digit != prev ) return false ; prev = digit ; } return true ; } public static void Main ( ) { int num = 2000 , base1 = 7 ; if ( isRepdigit ( num , base1 ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }
Enlightened Numbers | C # implementation of the above approach ; Function to check if N is a Composite Number ; Corner cases ; This is checked so that we can skip middle five numbers in below loop ; Function to return concatenation of distinct prime factors of a given number n ; Handle prime factor 2 explicitly so that can optimally handle other prime factors . ; n must be odd at this point . So we can skip one element ( Note i = i + 2 ) ; While i divides n , print i and divide n ; This condition is to handle the case when n is a prime number greater than 2 ; Function to check if a number is is an enlightened number ; Number should not be prime ; Converting N to string ; Function call ; Driver code
using System ; class GFG { static bool isComposite ( int n ) { if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } static String concatenatePrimeFactors ( int n ) { String concatenate = " " ; if ( n % 2 == 0 ) { concatenate += "2" ; while ( n % 2 == 0 ) n = n / 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { concatenate += i ; while ( n % i == 0 ) n = n / i ; } } if ( n > 2 ) concatenate += n ; return concatenate ; } static bool isEnlightened ( int N ) { if ( ! isComposite ( N ) ) return false ; String num = String . Join ( " " , N ) ; String prefixConc = concatenatePrimeFactors ( N ) ; return num . StartsWith ( prefixConc ) ; } public static void Main ( String [ ] args ) { int n = 250 ; if ( isEnlightened ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }
Second Pentagonal numbers | C # implementation to find N - th term in the series ; Function to find N - th term in the series ; Driver code
using System ; class GFG { static void findNthTerm ( int n ) { Console . Write ( n * ( 3 * n + 1 ) / 2 + " STRNEWLINE " ) ; } public static void Main ( ) { int N = 4 ; findNthTerm ( N ) ; } }
Idoneal Numbers | C # implementation for the above approach ; Function to check if number is an Idoneal numbers ; Iterate for all triples pairs ( a , b , c ) ; If the condition is satisfied ; Driver Code ; Function Call
using System ; class GFG { static bool isIdoneal ( int n ) { for ( int a = 1 ; a <= n ; a ++ ) { for ( int b = a + 1 ; b <= n ; b ++ ) { for ( int c = b + 1 ; c <= n ; c ++ ) { if ( a * b + b * c + c * a == n ) return false ; } } } return true ; } public static void Main ( ) { int N = 10 ; if ( isIdoneal ( N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Lynch | C # program for above approach ; Function to check the divisibility of the number by its digit . ; If the digit divides the number then return true else return false . ; Function to check if all digits of n divide it or not ; Taking the digit of the number into digit var . ; Function to check if N has all distinct digits ; Create an array of size 10 and initialize all elements as false . This array is used to check if a digit is already seen or not . ; Traverse through all digits of given number ; Find the last digit ; If digit is already seen , return false ; Mark this digit as seen ; REmove the last digit from number ; Function to check Lynch - Bell numbers ; Driver Code ; Given Number N ; Function Call
using System ; class GFG { static bool checkDivisibility ( int n , int digit ) { return ( digit != 0 && n % digit == 0 ) ; } static bool isAllDigitsDivide ( int n ) { int temp = n ; while ( temp > 0 ) { int digit = temp % 10 ; if ( ! ( checkDivisibility ( n , digit ) ) ) return false ; temp /= 10 ; } return true ; } static bool isAllDigitsDistinct ( int n ) { bool [ ] arr = new bool [ 10 ] ; while ( n > 0 ) { int digit = n % 10 ; if ( arr [ digit ] ) return false ; arr [ digit ] = true ; n = n / 10 ; } return true ; } static bool isLynchBell ( int n ) { return isAllDigitsDivide ( n ) && isAllDigitsDistinct ( n ) ; } public static void Main ( ) { int N = 12 ; if ( isLynchBell ( N ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Repunit numbers | C # implementation to check if a number is Repunit Number ; Function to check if a number contains all the digits 0 , 1 , . . , ( b - 1 ) an equal number of times ; to store number of digits of n in base B ; to count frequency of digit 1 ; condition to check three or more 1 's  and number of ones is equal to number  of digits of n in base B ; Driver Code ; taking inputs ; function to check
using System ; class GFG { static bool isRepunitNum ( int n , int b ) { int length = 0 ; int countOne = 0 ; while ( n != 0 ) { int r = n % b ; length ++ ; if ( r == 1 ) countOne ++ ; n = n / b ; } return countOne >= 3 && countOne == length ; } public static void Main ( ) { int n = 31 ; int base1 = 2 ; if ( isRepunitNum ( n , base1 ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Gapful Numbers | C # program for the above approach ; Find the first digit ; Find total number of digits - 1 ; Find first digit ; Return first digit ; Find the last digit ; Return the last digit ; A function to check Gapful numbers ; Return true if n is gapful number ; Driver code ; Given number ; Function call
using System ; class GFG { static int firstDigit ( int n ) { int digits = ( int ) ( Math . Log ( n ) / Math . Log ( 10 ) ) ; n = ( int ) ( n / Math . Pow ( 10 , digits ) ) ; return n ; } static int lastDigit ( int n ) { return ( n % 10 ) ; } static bool isGapful ( int n ) { int first_dig = firstDigit ( n ) ; int last_dig = lastDigit ( n ) ; int concatenation = first_dig * 10 + last_dig ; return ( n % concatenation == 0 ) ; } public static void Main ( ) { int n = 108 ; if ( isGapful ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Economical Numbers | C # implementation to find Economical Numbers till n ; Array to store all prime less than and equal to MAX . ; Utility function for sieve of sundaram ; In general Sieve of Sundaram , produces primes smaller than ( 2 * x + 2 ) for a number given number x . Since we want primes smaller than MAX , we reduce MAX to half ; Main logic of Sundaram . Mark all numbers which do not generate prime number by doing 2 * i + 1 ; Since 2 is a prime number ; Print other primes . Remaining primes are of the form 2 * i + 1 such that marked [ i ] is false . ; Function to check if a number is a Economical number ; Count digits in original number ; Count all digits in prime factors of n pDigit is going to hold this value . ; Count powers of p in n ; If primes [ i ] is a prime factor , ; Count the power of prime factors ; Add its digits to pDigit . ; Add digits of power of prime factors to pDigit . ; If n != 1 then one prime factor still to be summed up ; ; If digits in prime factors is less than digits in original number then return true . Else return false . ; Driver code ; Finding all prime numbers before limit . These numbers are used to find prime factors .
using System ; using System . Collections . Generic ; class GFG { static int MAX = 10000 ; static List < int > primes = new List < int > ( ) ; static void sieveSundaram ( ) { bool [ ] marked = new bool [ MAX / 2 + 1 ] ; for ( int i = 1 ; i <= ( Math . Sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j = j + 2 * i + 1 ) marked [ j ] = true ; primes . Add ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . Add ( 2 * i + 1 ) ; } static bool isEconomical ( int n ) { if ( n == 1 ) return false ; int original_no = n ; int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits ++ ; original_no = original_no / 10 ; } int pDigit = 0 , count_exp = 0 , p = 0 ; for ( int i = 0 ; primes [ i ] <= n / 2 ; i ++ ) { while ( n % primes [ i ] == 0 ) { p = primes [ i ] ; n = n / p ; count_exp ++ ; } while ( p > 0 ) { pDigit ++ ; p = p / 10 ; } while ( count_exp > 1 ) { pDigit ++ ; count_exp = count_exp / 10 ; } } if ( n != 1 ) { while ( n > 0 ) { pDigit ++ ; n = n / 10 ; } } return ( pDigit < sumDigits ) ; } public static void Main ( String [ ] args ) { sieveSundaram ( ) ; for ( int i = 1 ; i < 200 ; i ++ ) if ( isEconomical ( i ) ) Console . Write ( i + " ▁ " ) ; } }
Check if all objects of type A and B can be placed on N shelves | C # implementation of the above approach ; Function to return if allocation is possible or not ; Stores the shelves needed for items of type - A and type - B ; Find number of shelves needed for items of type - A ; Fill A / K shelves fully by the items of type - A ; Otherwise ; Fill A / L shelves fully and add remaining to an extra shelf ; Find number of shelves needed for items of type - B ; Fill B / L shelves fully by the items of type - B ; Fill B / L shelves fully and add remaining to an an extra shelf ; Total shelves needed ; If required shelves exceed N ; Driver code
using System ; class GFG { static bool isPossible ( int A , int B , int N , int K , int L ) { int needa , needb ; if ( A % K == 0 ) needa = A / K ; else needa = A / K + 1 ; if ( B % L == 0 ) needb = B / L ; else needb = B / L + 1 ; int total = needa + needb ; if ( total > N ) return false ; else return true ; } public static void Main ( String [ ] args ) { int A = 3 , B = 3 , N = 3 ; int K = 4 , M = 2 ; if ( isPossible ( A , B , N , K , M ) ) Console . Write ( " YES " + " STRNEWLINE " ) ; else Console . Write ( " NO " + " STRNEWLINE " ) ; } }
Minimise N such that sum of count of all factors upto N is greater than or equal to X | C # program for the above approach ; Array to store smallest prime factors of each no . ; Function to calculate smallest prime factor of N . ; marking spf [ j ] if it is not previously marked ; Array to store the count of factor for N ; Prefix array which contains the count of factors from 1 to N ; Function to count total factors from 1 to N ; Store total factors of i ; Stores total factors from 1 to i ; Function to search lowest X such that the given condition is satisfied ; Find mid ; Search in the right half ; Search in the left half ; Return the position after Binary Search ; Function to find the required sum ; Precompute smallest prime factor of each value ; Calculate count of total factors from 1 to N ; Binary search to find minimum N ; Driver Code ; Given Sum ; Function Call
using System ; class GFG { const int MAX = 1000050 ; static int [ ] spf = new int [ MAX + 1 ] ; static void calculate_SPF ( ) { for ( int i = 0 ; i <= MAX ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i <= MAX ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i <= MAX ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j <= MAX ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static int [ ] tfactor = new int [ MAX + 1 ] ; static int [ ] pre = new int [ MAX + 1 ] ; static void CountTotalfactors ( ) { tfactor [ 1 ] = pre [ 1 ] = 1 ; for ( int i = 2 ; i <= MAX ; i ++ ) { int mspf = spf [ i ] ; int prim = mspf ; int temp = i ; int cnt = 0 ; while ( temp % mspf == 0 ) { temp /= mspf ; cnt += 1 ; prim = prim * mspf ; } tfactor [ i ] = ( cnt + 1 ) * tfactor [ temp ] ; pre [ i ] = pre [ i - 1 ] + tfactor [ i ] ; } } static int BinarySearch ( int X ) { int start = 1 ; int end = MAX - 1 ; while ( start < end ) { int mid = ( start + end ) / 2 ; if ( pre [ mid ] == X ) return mid ; else if ( pre [ mid ] < X ) start = mid + 1 ; else end = mid ; } return start ; } static void findSumOfCount ( int X ) { calculate_SPF ( ) ; CountTotalfactors ( ) ; Console . Write ( BinarySearch ( X ) + " STRNEWLINE " ) ; } public static void Main ( ) { int X = 10 ; findSumOfCount ( X ) ; } }
Check if the Matrix follows the given constraints or not | C # implementation of the above approach ; Stores true at prime indices ; Function to generate the prime numbers using Sieve of Eratosthenes ; If p is still true ; Mark all multiples of p ; Function returns sum of all elements of matrix ; Function to check if for all prime ( i + j ) , a [ i , j ] is prime ; If index is prime ; Driver Code ; Check for both conditions
using System ; class GFG { static bool [ ] prime ; static void buildSieve ( int sum ) { prime = new bool [ sum + 1 ] ; for ( int i = 0 ; i < prime . Length ; i ++ ) prime [ i ] = true ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p < ( sum + 1 ) ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i < ( sum + 1 ) ; i += p ) prime [ i ] = false ; } } } static int getSum ( int [ , ] a ) { int s = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) for ( int j = 0 ; j < 5 ; j ++ ) s += a [ i , j ] ; return s ; } static bool checkIndex ( int n , int m , int [ , ] a ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( prime [ i + j ] && ! prime [ a [ i , j ] ] ) { return false ; } } } return true ; } public static void Main ( String [ ] args ) { int n = 4 , m = 5 ; int [ , ] a = { { 1 , 2 , 3 , 2 , 2 } , { 2 , 2 , 7 , 7 , 7 } , { 7 , 7 , 21 , 7 , 10 } , { 2 , 2 , 3 , 6 , 7 } } ; int sum = getSum ( a ) ; buildSieve ( sum ) ; if ( prime [ sum ] && checkIndex ( n , m , a ) ) { Console . Write ( " YES " + " STRNEWLINE " ) ; } else Console . Write ( " NO " + " STRNEWLINE " ) ; } }
How to calculate the Easter date for a given year using Gauss ' Algorithm | C # program for the above approach ; Function calculates and prints easter date for given year Y ; All calculations done on the basis of Gauss Easter Algorithm ; A corner case , when D is 29 ; Another corner case , when D is 28 ; If days > 31 , move to April April = 4 th Month ; Otherwise , stay on March March = 3 rd Month ; Driver code
using System ; class GFG { static void gaussEaster ( int Y ) { float A , B , C , P , Q , M , N , D , E ; A = Y % 19 ; B = Y % 4 ; C = Y % 7 ; P = ( float ) ( Y / 100 ) ; Q = ( float ) ( ( 13 + 8 * P ) / 25 ) ; M = ( 15 - Q + P - P / 4 ) % 30 ; N = ( 4 + P - P / 4 ) % 7 ; D = ( 19 * A + M ) % 30 ; E = ( 2 * B + 4 * C + 6 * D + N ) % 7 ; int days = ( int ) ( 22 + D + E ) ; if ( ( D == 29 ) && ( E == 6 ) ) { Console . Write ( Y + " - 04" + " - 19" ) ; return ; } else if ( ( D == 28 ) && ( E == 6 ) ) { Console . Write ( Y + " - 04" + " - 18" ) ; return ; } else { if ( days > 31 ) { Console . Write ( Y + " - 04 - " + ( days - 31 ) ) ; return ; } else { Console . Write ( Y + " - 03 - " + days ) ; return ; } } } public static void Main ( string [ ] args ) { int Y = 2020 ; gaussEaster ( Y ) ; } }