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 |
What is use of object as function?
What is closure? Give an example.
How do I turn on javascript in google chrome?
How to get complete current page url with javascript?
Is javascript used for backend?
How will you create new object in javascript?
What is an immediately-invoked function expression?
What is called variable typing in javascript?
How to remove duplicates from javascript array?
How to encode and decode a url in javascript?
What is difference between scripting and programming?
How do I enable cookies safari?