# C Program to Find Area of Rhombus

In this post, we will learn how to find the area of a rhombus using C Programming language.

Rhombus is a special kind of parallelogram whose all sides are equal.

The area of the rhombus can be calculated with the help of diagonals as given A = ½ x d1 x d2, where d1 = length of the first diagonal and d2 = length of the second diagonal.

We will be using this formula in our program to compute the area of rhombus.

So, without further ado, let’s begin this tutorial.

Contents

## C Program to Find Area of Rhombus

```// C Program to Find Area of Rhombus
#include <stdio.h>
int main(){
float d1, d2, area;

// Asking for input
printf("Enter the first diagonal of rhombus: ");
scanf("%f", &d1);
printf("Enter the second diagonal of rhombus: ");
scanf("%f", &d2);

// Calculating area
area = (d1 * d2) / 2;

// Displaying output
printf("Area of rhombus: %.2f", area);
return 0;
}
```

Output

``````Enter the first diagonal of rhombus: 12
Enter the second diagonal of rhombus: 15
Area of rhombus: 90.00
``````

## How Does This Program Work ?

```    float d1, d2, area;
```

In this program, we have declared three float data type variables named d1, d2,  and area.

```    // Asking for input
printf("Enter the first diagonal of rhombus: ");
scanf("%f", &d1);
printf("Enter the second diagonal of rhombus: ");
scanf("%f", &d2);
```

Then, the user is asked to enter the length of the first and second diagonal.

```    // Calculating area
area = (d1 * d2) / 2;
```

We calculate the area of the rhombus using the formula:
Area = (product of diagonals) / 2.

```    // Displaying output
printf("Area of rhombus: %.2f", area);
```

Finally, the area of the rhombus is displayed on the screen using printf() function.

## C Program to Find Area of Rhombus Using Functions

```// C Program to Calculate Area of Rhombus Using Functions
#include <stdio.h>
float area_rhombus(float d1, float d2){
return (d1 * d2) / 2;
}

int main(){
float d1, d2, area;

// Asking for input
printf("Enter rhombus first diagonal: ");
scanf("%f", &d1);
printf("Enter rhombus second diagonal: ");
scanf("%f", &d2);

// Calling out function
area = area_rhombus(d1, d2);

// Displaying output
printf("Area of rhombus: %.2f", area);
return 0;
}
```

Output

``````Enter rhombus first diagonal: 6
Enter rhombus second diagonal: 8
Area of rhombus: 24.00
``````

## Conclusion

I hope after going through this post, you understand how to find the area of a rhombus using C Programming language.

If you have any difficulty while understanding this program, let us know in the comment section. We will be delighted to solve your query.