Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


C Programming Code Examples

C > Mathematics Code Examples

C program to evaluate a given polynomial by reading its coefficients in an array. Formula is P(x)=AnXn + An-1Xn-1 + An-2Xn-2+... +A1X + A0. The 'polynomial' can be written as: P(x) =


C Program code to find area & circumference of circle. In this program we have to calculate the area and circumference of the circle. Two formulas for finding Circumference and Area


C program to find area of Parallelogram. This C code Calculates the 'Area of Parallelogram'. The formula used in this c program are Area = b*a where b is the length of any base, a is the


'Scalene Triangle' does not have sides having Equal Length & No angles of Scalene Triangle are equal. To calculate Area, we need at least two sides and the angle included by them. So

C Language program to calculates the area of trapezium. The Formula used in this program are Area = (1/2) * (x + y) * h where x and y are the Two Bases of Trapezium & h is the height.


C Coding calculate the Fibonacci Numbers in the series. First two numbers in the Fibonacci sequence are 0, 1 & each subsequent number is the sum of the previous 2. Fn = Fn-1 + Fn-2

C Program Code to using Recursion, finds the GCD of the two numbers entered by the user. The user enters 2 numbers by using a space in between them or by pressing enter after each





Take two binary numbers as input and store it in the variables binary1 and binary2. Initialize the variables multiply and factor with 0 and 1 respectively. Divide the variable binary2 by 10

C Program calculates the roots of a quadratic equation. First it finds Discriminant using the Formula: Disc = 'y*y-4*x*z'. There are 3 types of roots. They are complex, distinct and equal


C Language program code to find Power of a Number using Recursion. Power of a number is the number multiplied to itself for number of times it has been raised to Exam. 9^3=729

C Program code Find out the prime numbers between 1 to 100, 100 to 999... Input a range, for e.g. if you want the Prime Numbers from 100 to 999 then enter numbers 100 and 999...

The program takes the range and finds all the 'Prime Numbers' between the range & prints. Lets first take the range of numbers between which you have to find the prime numbers as


User is asked to enter the Dividend & Divisor and the program then finds the quotient and remainder based on the input values and the modulus operator "%" returns the remainder
C Program code finds the Areas of different Geometrical Figures. The program is menu driven program. This has 4 options that can be choosen by the user. Area of Circle, Area
This program takes the 3 numbers & finds the biggest among all. Take the three numbers as input and Check the First number if it Greater than other two. Repeat the step 2 for other 2
C Program calculates the GCD and LCM of 2 integers. Here gcd means greatest common divisor. For two integers a and b, if there are any numbers d so that a / d and b / d doesn't
Prints the Fibonacci of a given number using recursion. In fibonacci series, each number is the sum of the two preceding numbers. 0, 1, 1, 2, 3, 5, 8, ... The following program returns
This C Program calculates the perimeter of a circle, rectangle and triangle. This program is used to find the perimeter of circle, rectangle and triangle. Perimeter of rectangle: 2 *(x+y)
Program calculates the the sum of A.P series. This C program is used to find the sum of the "Arithmetic Progression Series" and Here A.P stands for Arithmetic Progression. Sequence
We will see 2 C programs to calculate the sum of natural numbers. In the first C program we are using For Loop for find the sum and in the second program we are doing the same using
C Language program is used to Find the Sum of the geometric progression series. Here G.P stands for geometric progression. Geometric progression, or GP, is a sequence where each
This C program is used to find the sum of the 'Harmonic Progression Series'. H.P stands for harmonic progression. Harmonic progression is a progression formed by taking reciprocals
Take two Binary Numbers as input. Add each bits from the two binary numbers separately starting from LSB. The operations may be as follows. a) (0+0)=0, b) (1+0)=1, c) (1+1)=0 and
This C Program to calculates the volume and surface area of cone. This program is used to find the the volume and surface area of cone. Surface_Area = Pi * r * (r + sqrt(r2 + h2)) and

Page 1 Page 2 Page 3 Page 4