write a program to generte a harmonic series
1+1/2+1/3+1/4+1/5 upto 15 terms.
Answer / upendar
<html>
<head>
<script type="text/javascript">
function hormonicSeries() {
for(var i=1;i<=15;i++) {
if(i == 1) {
var addSeries = 1/i;
} else {
for(var j=2; j<=15;j++) {
if(i == j) {
addSeries = addSeries +"+1/"+i ;
}
}
}
}
var series = addSeries;
document.write(series);
}
</script>
</head>
<body onload="hormonicSeries();">
</body>
</html>
| Is This Answer Correct ? | 4 Yes | 3 No |
Where do I put javascript code in html?
In how many ways a Javascript code can be involved in an HTML file?
What does clean white space mean?
why we need java instead of c
what is pop()method in JavaScript?
Which is best for front end?
do any browser need activeX object to run javascripts?
Describe the properties of an anonymous function in JavaScript?
How do I install javascript?
What is the difference between let and var?
What will be the output of the code below? var Y = 1; if (function F(){}) { y += Typeof F;</span> } console.log(y);
What's the purpose of javascript?