Validating Triangles

I'm very new at this so I have this question that we are doing in class, here it is.

'Write a program that prompts the user to enter the three values (one for each of the three edges for a triangle).
It then determines whether the input values are valid. [The input is valid if the sum of any two edges is greater than
the third edge.] Here are sample runs of this program:'


Enter values of the three edges (separated by spaces): 1 2 1
Can edges 1, 2, and 1 form a triangle? No

Enter values of the three edges (separated by spaces): 2 2 1
Can edges 2, 2, and 1 form a triangle? Yes

Any help would be much appreciated.
Last edited on
are you asking us to code it for you? what is the question?
whoops no! sorry i didn't add that but should i use a if/else statement or a switch statement....i don't know because well i'm pretty stumped!
I'm pretty sure the if-else statement can accomplish the same thing as a switch statement. So it is up to you to figure out which one you want to use. But I'm still learning. Post some code and give the specifics you need help on.
yeah, thats up to you. i prefer using if/else statements, but thats just me.
i'd be glad to take a look at your code and offer some advice if you want, but if you do post code, please put it between code tags found under "Format:" the button "<>"
Last edited on
Topic archived. No new replies allowed.