More on Conditionals HackerRank Solution

Hello coders, In this post, you will learn how to solve the More on Conditionals HackerRank Solution. This problem is a part of the Linux Shell series.

More on Conditionals HackerRank Solution

Problem

Given three integers (XY, 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 <= XYZ <= 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 Solution

#!/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 Conditionalsis generated by HackerRank but the solution is provided by chase2learn. This tutorial is only for Learning and Educational purpose.

Sharing Is Caring