Triangle Type
beginnerUp next
Loops
Repeat actions with while and for loops, and control them with break and continue.
Next lessonUp next
Repeat actions with while and for loops, and control them with break and continue.
Next lessonOutput will appear here...
The starter code reads the three side lengths of a triangle. Print one of these exactly:
not a triangle: the two shorter sides don't add up to more than the longest sideequilateral: all three sides are equalisosceles: exactly two sides are equalscalene: all sides are differentFor 3, 4, 5 a correct solution prints scalene. For 1, 2, 3 it prints not a triangle, because 1 + 2 is not greater than 3.
Tip
Check for not a triangle first. If a side is longer than or equal to the other two combined, there's no point checking the rest.
No comments yet. Start the discussion.