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 1

C 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 Rhombus First diagonal = ");
    scanf("%f",&rmD1);

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

    rmArea = rhombusArea(rmD1, rmD2);

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