Program to calculate area of a rhombus whose one side and diagonal are given Last Updated : 07 Aug, 2022 Comments Improve Suggest changes Like Article Like Report Given the length of diagonal 'd1' of a rhombus and a side 'a', the task is to find the area of that rhombus. A rhombus is a polygon having 4 equal sides in which both the opposite sides are parallel, and opposite angles are equal. Examples: Input: d = 15, a = 10 Output: 99.21567416492215 Input: d = 20, a = 18 Output: 299.3325909419153 Approach: Get the diagonal 'd1' and side 'a' of the rhombusWe know that, But since we don't know the other diagonal d2, we cannot use this formula yetSo we first find the second diagonal d2 with the help of d1 and a Now we can use the area formula to compute the area of the Rhombus C++ // C++ program to calculate the area of a rhombus // whose one side and one diagonal is given #include<bits/stdc++.h> using namespace std; // function to calculate the area of the rhombus double area(double d1, double a) { // Second diagonal double d2 = sqrt(4 * (a * a) - d1 * d1); // area of rhombus double area = 0.5 * d1 * d2; // return the area return area; } // Driver code int main() { double d = 7.07; double a = 5; printf("%0.8f", area(d, a)); } // This code is contributed by Mohit Kumar Java // Java program to calculate the area of a rhombus // whose one side and one diagonal is given class GFG { // function to calculate the area of the rhombus static double area(double d1, double a) { // Second diagonal double d2 = Math.sqrt(4 * (a * a) - d1 * d1); // area of rhombus double area = 0.5 * d1 * d2; // return the area return area; } // Driver code public static void main (String[] args) { double d = 7.07; double a = 5; System.out.println(area(d, a)); } } // This code is contributed by AnkitRai01 Python3 # Python program to calculate # the area of a rhombus # whose one side and # one diagonal is given # function to calculate # the area of the rhombus def area(d1, a): # Second diagonal d2 = (4*(a**2) - d1**2)**0.5 # area of rhombus area = 0.5 * d1 * d2 # return the area return(area) # driver code d = 7.07 a = 5 print(area(d, a)) C# // C# program to calculate the area of a rhombus // whose one side and one diagonal is given using System; class GFG { // function to calculate the area of the rhombus static double area(double d1, double a) { // Second diagonal double d2 = Math.Sqrt(4 * (a * a) - d1 * d1); // area of rhombus double area = 0.5 * d1 * d2; // return the area return area; } // Driver code public static void Main (String []args) { double d = 7.07; double a = 5; Console.WriteLine(area(d, a)); } } // This code is contributed by Arnab Kundu JavaScript <script> // javascript program to calculate the area of a rhombus // whose one side and one diagonal is given // function to calculate the area of the rhombus function area(d1 , a) { // Second diagonal var d2 = Math.sqrt(4 * (a * a) - d1 * d1); // area of rhombus var area = 0.5 * d1 * d2; // return the area return area; } // Driver code var d = 7.07; var a = 5; document.write(area(d, a)); // This code is contributed by 29AjayKumar </script> Output: 24.999998859949972 Time Complexity: O(log(n)) as inbuilt sqrt function is used Auxiliary Space: O(1) Comment More infoAdvertise with us Next Article Program to calculate area of a rhombus whose one side and diagonal are given A Atul_kumar_Shrivastava Follow Improve Article Tags : Mathematical Geometric DSA area-volume-programs Practice Tags : GeometricMathematical Similar Reads Program to calculate area and perimeter of a rhombus whose diagonals are given Given the length of diagonals of a rhombus, d1 and d2. The task is to find the perimeter and the area of that rhombus. A rhombus is a polygon having 4 equal sides in which both the opposite sides are parallel, and opposite angles are equal. Examples: Input: d1 = 2 and d2 = 4 Output: The area of rhom 5 min read Find the area of rhombus from given Angle and Side length Given two integers A and X, denoting the length of a side of a rhombus and an angle respectively, the task is to find the area of the rhombus. A rhombus is a quadrilateral having 4 sides of equal length, in which both the opposite sides are parallel, and opposite angles are equal. Examples: Input: A 3 min read Length of diagonals of a Rhombus using length of Side and vertex Angle Given two integers A and theta, denoting the length of a side of a rhombus and the vertex angle respectively, the task is to find the length of the diagonals of the rhombus. Examples: Input: A = 10, theta = 30 Output: 19.32 5.18 Input: A = 6, theta = 45 Output: 11.09 4.59 Approach: The problem can b 4 min read Program to calculate area of an Circle inscribed in a Square Given the side of a square. The task is to find the area of an inscribed circle in a square.Examples: Input : a = 8 Output : Area of an inscribed circle: 50.24 Input : a = 12.04 Output : Area of an inscribed circle: 113.795 Given a square i.e. all sides of a square are of equal length and all four a 4 min read Find area of parallelogram if vectors of two adjacent sides are given Given two vectors in form of (xi+yj+zk) of two adjacent sides of a parallelogram. The task is to find out the area of a parallelogram.Example: Input: x1 = 3, y1 = 1, z1 = -2 x2 = 1, y2 = -3, z2 = 4Output: Area = 17.3205081 Input: x1 = 1, y1 = 3, z1 = 2 x2 = 1, y2 = -3, z2 = 4Output: Area = 19.078784 5 min read Like