C Program to find Area of a Rhombus

Write a C Program to Find the Area of a Rhombus with an example. The mathematical formula to find the Rhombus area is (diagonal1 * diagonal2)/2. This example allows entering first and second diagonals and returns the rhombus area.

#include <stdio.h>

int main()
{
    float rmD1, rmD2, rmArea;
    
    printf("Enter the Rhombus First diagonal = ");
    scanf("%f",&rmD1);

    printf("Enter the Rhombus Second diagonal = ");
    scanf("%f",&rmD2);

    rmArea = (rmD1 * rmD2)/2;

    printf("The Area of a Rhombus = %.2f\n", rmArea); 
    
    return 0;
}
C Program to find Area of a Rhombus

Program to Find the Area of a Rhombus using functions.

#include <stdio.h>

float rhombusArea(float rmD1, float rmD2)
{
    return (rmD1 * rmD2)/2;
}
int main()
{
    float rmD1, rmD2, rmArea;
    
    printf("Enter the First diagonal = ");
    scanf("%f",&rmD1);

    printf("Enter the Second diagonal = ");
    scanf("%f",&rmD2);

    rmArea = rhombusArea(rmD1, rmD2);

    printf("The Area = %.2f\n", rmArea);
    
    return 0;
}
Enter the First diagonal = 11
Enter the Second diagonal = 17
The Area = 93.50

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.