Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
571 B
1
Indexable
Never
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract RightAngledTriangle {
    function check(uint a, uint b, uint c) public pure returns (bool) {
        // Check if it's possible to create a right-angled triangle
        if (a > 0 && b > 0 && c > 0) {
            if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a) {
                // The sides can form a right-angled triangle
                return true;
            }
        }
        
        // The sides cannot form a right-angled triangle
        return false;
    }
}