Page

Program to evaluate series 1+1/2+1/3+1/4+-------+1/N in java script

<html>
<head><h2><center>program to evaluate series 1+1/2+1/3+1/4+-------+1/N</h2></center></head>
<body>
<script type="text/javascript">
n=parseInt(prompt("enter the value for n"," "));
s=0.0;
for(i=1;i<=n;i++)
{
s=s+(1/i);
}
document.write("the sum of series is "+s);
</script>
</body>
</html>

No comments:

Post a Comment