+ 1
Will it be a triangle? (JavaScript)
The task: Ask for three positive numbers (a,b,c), -Determine if it is true: a + b> c and a + c> b and b + c >a? -If the above is true then you can make a triangle from the values, otherwise there can be no such triangle. -Check the numbers requested to make sure they are all positive! Thanks in advance!
3 Answers
+ 4
first you need to correctly format your code...
second you are writting javascript code in java code playground (they are two distinct languages: rather use nodejs or web playground projects).
third, you function name must not contains spaces in it (you can use underline char instead)...
finally, you must call the function by providing the required arguments values:
function second_degree(a,b,c,i) {
var d = b*b-4*a*c;
if (d < 0) {
return "the equation has no solution";
}
d = Math.sqrt(d);
if (i==1) {
return (-b + d) / (2*a);
}
return (-b - d) / (2*a);
}
console.log(second_degree(/*here you need to put values*/));
+ 1
Your try ???



