Here is the listing of C programming examples on Mathematical Functions:
1. C Examples on Mathematical Calculations
The following section contains programs which demonstrate mathematical calculations. These include calculating simple interest, finding out the roots of a quadratic equation and simulating a simple calculator.
C Program to Calculate the Simple Interest
C Program to Find out the Roots of a Quadratic Equation
C Program to Simulate a Simple Calculator
2. C Examples on Fibonacci Numbers
A Fibonacci number is the number in which the first two numbers are 1 and 1 and the succeeding number is the sum of the two preceding numbers. The section contains programs to generate fibonacci series and to find the Nth fibonacci number using recursion.
C Program to Generate Fibonacci Series
C Program to find the Nth Fibonacci Number using Recursion
C Program to Find First N Fibonacci Numbers
3. C Examples on GCD and LCM of Numbers
GCD of two integers is the largest positive integers that divides the two integers with remainder as 0 and LCM of two integers is the smallest positive integer that is the multiple of both the integers. The sine function is a trigonometric function which is the ratio of the length of the side opposite to the angle theta and the length of the triangle’s hypotenuse in a given right angled triangle. The cosine function is another trigonometric function which is the ratio of the length of the side adjacent to the angle theta and the length of the triangle’s hypotenuse in a given Right angled triangle. The following programs demonstrate the implementation of GCD and LCM of 2 integers, values of sin(x) and cos(x) respectively.
4. C Examples on Statistical Properties
The following section contains programs which calculate the summation of first N natural numbers, determines if the given number is prime or not, finds the prime numbers in a given range, calculates the given polynomial equation and evaluates the mean, variance & standard deviation.Mean is the average of the given numbers, Variance is the average of the squared differences from the mean and standard deviation is a measure of how spread out numbers are.
5. C Examples on Power and Factorial of a Number
Multiplying a number by itself gives the power of a number. A factorial is a function that multiplies a number by every number below it. The following programs compute the power and factorial of a given number using recursion and also displays the multiplication table.
6. C Examples on Summation of a Series
A sequence is an ordered list of numbers. The sum of the terms of a sequence is called a series. The following programs calculate the sum of a particular given series. It also calculates the sum of a A.P Series, G.P Series and H.P Series. A number sequence in which the difference between the consecutive terms is constant is called Arithmetic Progression and the sum of a finite arithmetic progression is called Arithmetic Series. A number sequence in which the ratio of the consecutive terms is constant is called Geometric Progression and the sum of a finite geometric progression is called Geometric Series. Harmonic Progression is the reciprocal of Arithmetic Progression.
7. C Examples on finding the Area of Geometrical Figures
The following programs calculate the area of a Triangle, a Circle, a Trapezium, a Rhombus and a Parallelogram. A Triangle is obtained by joining 3 non-collinear points. A circle is the locus of all points equidistant from a central point. A trapezium is a quadrilateral that has one pair of parallel sides. A Rhombus is a 4-sided quadrilateral in which all the four sides are equal. A Parallelogram is a quadrilateral that has two pairs of parallel sides.
8. C Examples on finding the Volume and Surface Area of Geometrical Figures
The following programs calculate the volume and surface area of a Cube, a Cylinder, a Cuboid, a Cone and a Sphere. A cube is a 3-D object with 6 sides. A cylinder is a solid object with two identical flat ends that are circular and one curved side. A cuboid is a box-shaped solid object which has six flat sides. A cone is a rotated triangle. A sphere is a a round figure whose surface is equidistant from all the points.
9. C Examples on implementation of Floyd and Pascal’s Triangle
A right-angled triangular array of natural numbers is called Floyd triangle. Pascal’s Triangle is a triangle of numbers where each number is the two numbers above it added together. The following programs illustrate the implementation of Floyd’s triangle and Pascal’s triangle.
C Program to Display Floyd’s Triangle
C Program to Display Pascal triangle
C Program to Calculate the Value of nPr