0

What ist the problem?

function pythagoras() { var Kathete1 = prompt(" Gib die Länge der ersten Kathete an: "); var Kathete2 = prompt(" Gib die Länge der zweiten Kathete an: "); if((Kathete1 * 2) + (Kathete2 * 2) (Math.sqrt((Kathete1 * 2 ) + (Kathete * 2))) alert(" Die Hypotenusenlänge beträgt " + (Math.sqrt((Kathete1 * 2 ) + (Kathete * 2)))) }

15th Jan 2020, 4:35 PM
Shamuon Hennawi
Shamuon Hennawi - avatar
1 ответ
+ 1
The prompt() function returns a string, so you should probably cast the returned value to an actual number before operating on it via the parseInt() or parseFloat() function. https://www.w3schools.com/jsref/jsref_parseint.asp https://www.w3schools.com/jsref/jsref_parsefloat.asp I didn't look for anything else, does this solve your problem?
15th Jan 2020, 4:38 PM
Shadow
Shadow - avatar