We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
-- MS SQL Server
select case
when ((t.A+t.B)<=t.C) or ((t.A+t.C)<=t.B) or ((t.B+t.C)<=t.A)
then 'Not A Triangle'
else
case
when (t.A = t.B) and (t.A = t.C) then 'Equilateral'
else
case
when (t.A = t.B) or (t.A=t.C) or (t.C=t.B) then 'Isosceles'
else
'Scalene '
end
end
end
from TRIANGLES as t
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Type of Triangle
You are viewing a single comment's thread. Return to all comments →
-- MS SQL Server select case when ((t.A+t.B)<=t.C) or ((t.A+t.C)<=t.B) or ((t.B+t.C)<=t.A) then 'Not A Triangle' else case when (t.A = t.B) and (t.A = t.C) then 'Equilateral' else case when (t.A = t.B) or (t.A=t.C) or (t.C=t.B) then 'Isosceles' else 'Scalene ' end end end from TRIANGLES as t