A rhombus is a simple quadrilateral with all four sides having the same length. The perimeter of a rhombus can be found in two ways.
A quadrilateral has two diagonals. The area and perimeter of the quadrilateral can be found based on the length of the diagonals.
Using the diagonal of the rhombus to find the perimeter of the rhombus is 2{√(d1)2 (d2)2 }
Logic - Use the diagonals of a rhombus to find its perimeter. You need the formula 2{√(d1)2 (d2)2 } In your code you need to use a math class that supports squareRoot and the squaring of numbers.
The following code shows a program to find the perimeter of a rhombus using its diagonals.
#include <stdio.h> #include <math.h> int main(){ int d1 = 3, d2= 4, perimeter; perimeter = (2 * sqrt(pow(d1,2)+pow(d2,2))); printf("perimeter is %d", perimeter); return 0; }
perimeter is 10
The above is the detailed content of Program to find the perimeter of a rhombus using diagonals. For more information, please follow other related articles on the PHP Chinese website!