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 |
Is javascript insecure?
what is the difference between wrappers and primitives es: diff between int i=200 in primitives and integeri = new integer(54)
What does javascript do?
Explain the unshift() method ?
How to enabled 'Strict' mode in JavaScript?
What are the main functions performed by javascript statements?
Is it safe to use javascript?
What's the difference methods get and post in html forms?
What are the valid scopes of a variable in JavaScript?
Which is better for or foreach in javascript?
What's the Difference Between Class and Prototypal Inheritance?
How to add buttons in javascript?