C Program to Find the Area of Rhombus

devquora
devquora

Posted On: Jan 26, 2023

C Program to Find the Area of Rhombus

 

Overview:

In general, the term “area” is defined as the region occupied inside the boundary of a flat object or figure. Before, Starting this article First of all, I want to introduce you with Geometric Shape Rhombus . Then I will explain What do you mean by area of a Rhombus . Moreover, I will demonstrate how to find area of a Rhombus? Furthermore, I will write logic and c program to find area of Rhombus with output. After all, I will explain the resultant output.

Table of contents:

  1. What are the characteristics of quadrilateral?
  2. What is a Rhombus?
  3. What are the properties of the Rhombus?
  4. What is a Rhombus?
  5. Demonstration how to find area of a Rhombus.
  6. Main Logic to find the area of a Rhombus
  7. C program to find area of Rhombus
  8. Conclusion

What are the characteristics of quadrilateral?

The word Quadrilateral is derived from the two latin words quad and lateral which means four and sides respectively.  A Quadrilateral has four-sides, it is 2-dimensional (a flat shape), closed (the lines join up), and has straight sides.

What is a Rhombus ?

A rhombus is quadrilaterals(having four sides) with all sides equal in length and opposite sides parallel. Opposite angles of a rhombus are also equal. A rhombus is a special case of parallelogram where all sides are equal in length.

What are the properties of the Rhombus ?

The properties of Rhombus are given below:

  1. Diagonals of a rhombus are perpendicular and divides each other in two equal half.
  2. Opposite sides of a rhombus are parallel and all sides are equal in length.
  3. Opposite angles of a rhombus are equal.
  4. The sum of any two adjacent angles of a rhombus are 180 degrees.
  5. The diagonal of rhombus bisects the interior angle.
  6. The sum of the two adjacent angles of a Rhombus is 180 degrees.

What do you mean by the area of a Rhombus ?

To calculate the area of rhombus we need length of Base and Height of length of both diagonals. Base : We can choose any side of a rhombus as base to calculate the area of the rhombus. Height : Height of a rhombus is the perpendicular distance between the base and it's opposite side. Diagonals : A line segment joining opposite vertices of a rhombus.

The area of a Rhombus is calculated as follows:

A = Product of diagonal/2

A = (BC × AD)/2

Where,

BC and AD are the diagonals of the Rhombus.

Demonstration how to find area of a Rhombus

Rhombus  Area

Main Logic to find the area of a Rhombus

The code will use 3 variables as all diagonals of the Rhombus and one for the area of Rhombus, we will take a float variable that will be initialised with the value. To calculate it we will use the formula Area = (product of diagonal) /2

C program to find area of Rhombus

/*
/*
* C Program to calculate area of rhombus
*/
#include <stdio.h>
#include <conio.h>
 
int main(){
    float diagonalOne, diagonalTwo, area;
    printf("Enter the length of diagonals of rhombus\n");
    scanf("%f %f", &diagonalOne, &diagonalTwo);
    /* Area of rhombus = (product of diagonals)/2 
                       = (diagonalOne X diagonalTwo)/2 */
    area = (diagonalOne * diagonalTwo)/2;
    printf("Area of rhombus : %0.4f\n", area);
     
    getch();
    return 0;
}

The output of the Program:

Enter the length of parallel sides of Rhombus 4 7 Enter the height of Rhombus 3.5 Area of Rhombus : 19.2500

Area of Rhombus  Output

Conclusion

Above program first takes length of diagonals as input form user using scanf function and stores it in two floating point variables. Then it calculates the area of Rhombus using the formula given above. Then, it prints the area of Rhombus on screen using printf function.

    Please Login or Register to leave a response.

    Related Articles

    C Program Examples

    C Program to convert Decimal to Binary Number

    A Decimal Number is constructed with any digit from 0 to 9. For instance, 24 is a Decimal Number constructed from the digits 2 and 4. A Binary Number is constructed with digits 0 and 1. For instance, ..

    C Program Examples

    C program to reverse a string

    This program reversed the entered string that means opposite of the previous string sequence...

    C Program Examples

    C program to reverse an Integer number

    Are you want a demonstration of The C Program that reverses an Integer number? This Program reversing the sequence of digits in an Integer. After the successful compilation of the program, a message..