https://www.rakeshmgs.in/search/label/Template
https://www.rakeshmgs.in
RakeshMgs

Program to check whether the triangle is equilateral, isosceles or scalene triangle?

Updated:

इस प्रॉब्लम को solve करने के लिए ट्रायंगल का वैल्यू इनपुट देना होगा जिससे कौन-सा ट्रायंगल है इसका आउटपुट पता किया जा सके, इसे हम Python, C Programming और JavaScript के मदद से solve करेंगे तो चलिए स्टार्ट करते है-

Solve Using Python:



Solve Using C:

#include <stdio.h> int main() { int a, b, c; printf("Enter the sides of the triangle: "); scanf("%d %d %d", &a, &b, &c); if (a + b > c && a + c > b && b + c > a) { if(a == b && b == c) { printf("This is an equilateral triangle.\n"); } else if(a == b || b == c || a == c) { printf("This is an isosceles triangle.\n"); } else { printf("This is a scalene triangle.\n"); } } else { printf("This is not a triangle.\n"); } return 0; }

Solve Using JavaScript:

  <--Code by RakeshMgs-->
  <!DOCTYPE html>
<html>
<head>
    <title>Triangle Type Checker</title>
</head>
<body>
    <h1>Triangle Type Checker</h1>
    <form>
        <label for="a">Enter the length of side a:</label>
        <input type="number" id="a" name="a" required>
        <br>
        <label for="b">Enter the length of side b:</label>
        <input type="number" id="b" name="b" required>
        <br>
        <label for="c">Enter the length of side c:</label>
        <input type="number" id="c" name="c" required>
        <br>
        <button type="button" onclick="checkTriangle()">Check</button>
    </form>
    <br>
    <p id="result"></p>
    <script>
        function checkTriangle() {
            var a = document.getElementById("a").value;
            var b = document.getElementById("b").value;
            var c = document.getElementById("c").value;

            if(a==b && b==c)
            {
                document.getElementById("result").innerHTML = "This is an equilateral triangle.";
            }
            else if(a==b || b==c || a==c)
            {
                document.getElementById("result").innerHTML = "This is an isosceles triangle.";
            }
            else
            {
                document.getElementById("result").innerHTML = "This is a scalene triangle.";
            }
        }
    </script>
</body>
</html>


Output:

Triangle Type Checker






आपको आर्टिकल कैसा लगा? अपनी राय अवश्य दें
Please don't Add spam links,
if you want backlinks from my blog contact me on rakeshmgs.in@gmail.com