Untitled
unknown
plain_text
2 years ago
571 B
5
Indexable
// 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;
}
}Editor is loading...