write a program to generte a harmonic series
1+1/2+1/3+1/4+1/5 upto 15 terms.
Answer Posted / 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 |
Post New Answer View All Answers
How to toggle display an html element?
What is unescape() function?
How to show progress bar while loading using ajax call?
What is a method in javascript?
How do I open javascript in chrome?
What does js stand for?
Which built-in method calls a function for each element in the array?
If you need to hide the javascript code from the older browser versions, how will you perform it?
What is enum data type?
How to trigger a postback on an updatepanel from javascript?
How many functions are there in javascript?
What is prototype in javascript and how do you use it?
What is use strict in javascript?
Is a javascript script faster than an asp script?
What is dataview in javascript?