Program to calculate area of a rhombus whose one side and diagonal are given | C ++ program to calculate the area of a rhombus whose one side and one diagonal is given ; function to calculate the area of the rhombus ; Second diagonal ; area of rhombus ; return the area ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; double area ( double d1 , double a ) { double d2 = sqrt ( 4 * ( a * a ) - d1 * d1 ) ; double area = 0.5 * d1 * d2 ; return area ; } int main ( ) { double d = 7.07 ; double a = 5 ; printf ( " % 0.8f " , area ( d , a ) ) ; }