Circle area calculator

wxdqz

New Member
Hi,

I am trying to do a little script that calculates the area of a circle. It prompts before to ask for the radius then calculates. Well, it is supposed to do that. I tried but it doesn't give anything on the page.

Can you please have a look to tell me what is wrong?


<html>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

function doArea(num) {
var radius = prompt("Please enter the radius of the circle: ", "");
return (Math.PI * Math.pow(radius, 2));
}

</script>
</HEAD>

<BODY>

<script language="javascript">

var radius = prompt("Please enter the radius of the circle: ", "");
return (Math.PI * Math.pow(radius, 2));

document.write("The area of the circle is " + " ")

</form>
</body>
</html>
 
Back
Top