Program to calculate area and perimeter of a rhombus whose diagonals are given | C ++ Program to calculate area and perimeter of a rhombus using diagonals ; calculate area and perimeter of a rhombus ; Driver code
#include <iostream> NEW_LINE #include <math.h> NEW_LINE using namespace std ; int rhombusAreaPeri ( int d1 , int d2 ) { long long int area , perimeter ; area = ( d1 * d2 ) / 2 ; perimeter = 2 * sqrt ( pow ( d1 , 2 ) + pow ( d2 , 2 ) ) ; cout << " The ▁ area ▁ of ▁ rhombus ▁ with ▁ diagonals ▁ " << d1 << " ▁ and ▁ " << d2 << " ▁ is ▁ " << area << " . " << endl ; cout << " The ▁ perimeter ▁ of ▁ rhombus ▁ with ▁ diagonals ▁ " << d1 << " ▁ and ▁ " << d2 << " ▁ is ▁ " << perimeter << " . " << endl ; } int main ( ) { int d1 = 2 , d2 = 4 ; rhombusAreaPeri ( d1 , d2 ) ; return 0 ; }