Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this scenario, a user approaches you with three sticks, and you need to determine for them whether they will be able to make a

In this scenario, a user approaches you with three sticks, and you need to determine for them whether they will be able to make a triangle with them.
If you are given three sticks, you may or may not be able to arrange them in a triangle. For example, if one of the sticks is 12 inches long and the other two are only 1 inch long, you will not be able to get the short sticks to meet in the middle.
For any three lengths, there is a simple test to see if it is possible to form a triangle:
If any of the three lengths is greater than the sum of the other two, then you cannot form a triangle. Otherwise, you can.
Write code in the cell below that gets three stick lengths from a user, and that determines and prints for them whether or not they will be able to form a triangle with their sticks.
For example, if the user gives the lengths 3,11, and 6, then we should tell them they cannot form a triangle (because 11>3+6
). But if the user gives the lengths 5,2, and 4, then we should tell them they can.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions