C# Basic Programs | basics
- C# | Print messages/text (program to print Hello world)
- C# program to demonstrate example of Console.Write() and Console.WriteLine()
- C# program to print a new line
- C# program to print backslash (\\)
- C# program to demonstrate the example of New keyword
- C# program to print size of various data types
- C# program for type conversion from double to int
- C# program to convert various data type to string using ToString() method
- C# program to define various types of constants
- C# | Input and print an integer number
- C# program to demonstrate example of arithmetic operators
- C# | Declare different types of variables, assign the values and print
- C# program to demonstrate example of assignment operators
- C# program to demonstrate example of sizeof() operator
- C# program to demonstrate example of equal to and not equal to operators
- C# program to demonstrate example of relational operators
- C# program to demonstrate example of bitwise operators
- C# | Find the addition of two integer numbers
- C# program to swap two numbers with and without using third variable
- C# | print type, max and min value of various data types
- C# program to swap numbers using XOR operator
- C# program to find the magnitude of an integer number
- C# program to demonstrate the example of the left-shift operator
- C# program to read the grade of students and print the appropriate description of grade
- C# program to calculate the size of the area in square-feet based on specified length and width
- C# program to demonstrate the example of the right shift operator
- C# program to find the division of exponents of the same base
- C# program to demonstrate the example goto statement
- C# program to print a message without using the WriteLine() method
- C# program to convert a temperature from Celsius to Fahrenheit
- C# program to convert a meter into kilo-meter and vice versa
- C# program to convert a decimal number into a hexadecimal number
- C# program to convert a hexadecimal number into a decimal number
- C# program to convert a decimal number into an octal number
- C# program to convert a decimal number into a binary number
- C# program to convert a binary number into a decimal number
- C# program to convert a temperature from Fahrenheit into Celsius
- C# program to create gray code
- C# program to change the case of entered character
- C# program to convert entered days into years, weeks, and days
- C# program to convert the US dollar into Indian rupees
- C# program to print digits of a number into words
- C# program to check the given number is a perfect number or not
- C# program to print the all factors of a given number
- C# program to find the HCF of two given numbers
- C# program to check given numbers are the pair of amicable numbers or not
- C# program to find the addition of two complex numbers
- C# program to find the greatest common divisor (GCD)
- C# program to find the value of sin(x)
- C# program to demonstrate the trigonometry angles in degrees using Math class
- C# program to demonstrate the trigonometry angles in radians using Math class
- C# program to calculate the MEAN of a set of given numbers
- C# program to calculate the VARIANCE of a set of given numbers
- C# program to calculate the Standard Deviation of a set of given numbers
- C# program to calculate the compound interest
- C# program to calculate the Cosine(X) using a predefined method
- C# program to calculate the Cosine(X) without using a predefined method
- C# program to calculate the traveled distance based on speed and time
- C# program to print the Pascal Triangle
- C# program to calculate the sum of two binary numbers
- C# program to calculate the multiplication of two exponents of the same base
- C# program to print Floyd\'s triangle
- C# program to calculate the multiplication of two numbers using the left shift operator
- C# program to print the edge values using Pow() method
- C# program to calculate the fractional power of numbers
- C# program to demonstrate the bitwise operations
- C# program to find the root of a quadratic equation
- C# program to print the absolute value of a number without using Math.Abs() method
- C# program to find the Least Common Multiple of two numbers
- C# program to find the cube root of a given number
- C# program to find the square root of a given number without using Math.Sqrt() method
- C# program to calculate the area of a Cone
- C# program to calculate the volume of a cone
- C# program to calculate the volume of a cone
- C# program to calculate the area of Sphere
- C# program to calculate the volume of Sphere
- C# program to calculate the perimeter of Circle
- C# program to calculate the perimeter of Rectangle
- C# program to calculate the NCR
Program:
The source code to calculate the NCR is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
Here, we created a class Ncr that contains three static methods CalculateFactorial(), CalculateNcr(), and Main() method.
The CalculateFactorial() is used to calculate the factorial of the specified factorial and return to the calling method.
The CalculateNcr() is used to calculate the Ncr using the below formula.
The Main() method is the entry point for the program, Here we read the value of n and r and called the CalculateNcr() method that will return NCR that will be printed on the console screen.