 # C Programming Code Examples

## C > Mathematics Code Examples

C Language program to Amstrong Numbers. Armstrong Number is a number which equal to the sum of the cubes of its individual digits For example, 407 is an armstrong number as

C Area of Circle. Ellipse in which the two axes are of equal length. Plane curve generated by one point moving at a constant distance from a fixed point. You can compute area of circle.

A plane figure with 4 sides & 4 right angles & having Equal Opposite sides. Adjucent sides makes an Angle of 90 degree. Just compute the area of a Rectangle if you know its length

This C Program adds two complex numbers. A Complex Number is a number that can be put in the form a + bi, where a and b are real numbers & i is called imaginary unit, where...

In the following C program we are calculating & displaying the value of nCr. nCr can also be represented as C(n,r). C Language function is used to find the factorial of given number and

In the following c program we are calculating the value of nPr based on the given values of n and r. nPr can also be represented as P(n,r). The formula of P(n, r) is: n! / (n - r)!. P(5, 2)=5!

To calculate area and circumference we must know the radius of circle. C program code will prompt user to enter the radius and based on the input it would calculate the values. Make

An "Equilateral Triangle" has equal sides (all 3 sides are equal). In order to calculate the area of equilateral triangle, we must know the side of the triangle. This C program would prompt

C Language Program calculates the Area of a Circle given it's Radius. Lets use The formula to compute the 'area' is: Area = ? x r2 where r is the radius of the circle & ? value is 22/7. 'Pi'

This C Program code calculates the area of a triangle given it's three sides. The formula or algorithm used is: Area = sqrt(s(s - a)(s - b)(s - c)), where s = (a + b + c) / 2 or perimeter / 2. &

This C Program calculates the mean, variance and standard deviation. The formula which is used in this c program are mean = average of the numbers. var=(summation( ( Xj - average

Program calculates the simple interest given the principal amount, rate of interest & time. The Formula to calculate the Simple interest is: simple_interest = (p * t * r) / 100 where p...

This C Program to Calculates the value of nCr. The algorithm used in this program is nCr = n! /((n-r)!r!) and We need to Find all the Possible combination of the value n&r. A combination
C Program code calculates the value of nPr. A permutation is a re-arrangement of elements of a set. And any duplications of the collected elements in different orders is allowed. Then
C Program Coding to Calculates the Value of sin(x). It's a non-differentiable function. Start at zero, then goes up to 1, then back down to 0. But then, instead of Going Negative, it will
A number is called as "Armstrong Number" if Sum of Cubes of Digits of Number is equal to the number itself. In C code, we are checking the input number is Armstrong or not. Check
Program takes a number and checks whether a given number is Prime or not. Take number as Input & Check if the number is Divisible by any of the natural numbers starting from 2. If
If a number remains same, even if we reverse its digits then number is Palindrome number. So 10201 is a Palindrome Number because it remains same if we reverse its digits. C codes
Check whether a year is Leap or not by using this Mathematical Logic. If a year is divisible by 4, 100 & 400 then it is a leap year. If a year is divisible by 4 but not divisible by 100 then...
In this program, two User-Defined functions checkPrimeNum() & checkArmstrongNum() are created. The checkPrimeNum() returns 1 if the number entered by the user is a Prime
This C Program code checks whether a given number is armstrong number. An Armstrong number is an n-digit base b number such that the Sum of its Digits raised to the Power N is
This C program code checks whether a given number is perfect number. Perfect number is a number which is equal to sum of its divisor. For eg,divisors of 6 are 1,2 and 3. The sum of
Program to check whether a number can be expressed as sum of two prime numbers. To accomplish this task, "checkPrime()" function is created. The "checkPrime()" returns 1 if the
A prime number is a positive integer which is divisible only by 1 and itself. Example: 2, 3, 5, 7, 11, 13... If the for loop terminates when the test expression of loop i <= n/2 is false, it is a
The formula used to find the surface area and volume of the cube is surface_area = 6 * (a*a) and volume = a*a*a. Library Function is used in header file to compute Math Functions. We
This C Program takes a Positive Integer from the user & displays all the positive factors of that number. The for loop is iterated until j<= Number is False. In each iteration, number is
The Fibonacci Sequence is a series where the next term is the sum of pervious 2 terms. The first two terms of the Fibonacci sequence is 0 followed by 1. The sequence: 0, 1, 1, 2, 3, 5, 8,

Page 1 Page 2 Page 3 Page 4