Hello Programmers, In this post, you will know how to solve the More on Conditionals HackerRank Solution. This problem is a part of the HackerRank Linux Shell Series.
One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.
Problem
Given three integers (X, Y, and Z) representing the three sides of a triangle, identify whether the triangle is scalene, isosceles, or equilateral.
- If all three sides are equal, output
EQUILATERAL
. - Otherwise, if any two sides are equal, output
ISOSCELES
. - Otherwise, output
SCALENE
.
Input Format
Three integers, each on a new line.
Constraints
- 1 <= X, Y, Z <= 1000
- The sum of any two sides will be greater than the third.
Output Format
One word: either “SCALENE” or “EQUILATERAL” or “ISOSCELES” (quotation marks excluded).
Sample Input
Sample Input 1
2
3
4
Sample Input 2
6
6
6
Sample Output
Sample Output 1
SCALENE
Sample Output 2
EQUILATERAL
More on Conditionals HackerRank Solutions
#!/bin/bash read x read y read z if ((($x == $y) && ($y == $z))) then echo "EQUILATERAL" elif ((($x == $y) || ($x == $z) || ($y == $z))) then echo "ISOSCELES" else echo "SCALENE" fi
Note: This problem (More on Conditionals) is generated by HackerRank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.