Length of a Diagonal of a Parallelogram using the length of Sides and the other Diagonal | C ++ Program to implement the above approach ; Function to calculate the length of the diagonal of a parallelogram using two sides and other diagonal ; Driver Code ; Function Call ; Print the final answer
#include <bits/stdc++.h> NEW_LINE using namespace std ; float Length_Diagonal ( int a , int b , int d ) { float diagonal = sqrt ( 2 * ( ( a * a ) + ( b * b ) ) - ( d * d ) ) ; return diagonal ; } int main ( ) { int A = 10 ; int B = 30 ; int D = 20 ; float ans = Length_Diagonal ( A , B , D ) ; printf ( " % 0.1f " , ans ) ; return 0 ; }