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 are ‘settimeout()’?
Some XYZ company is arranging for online aptitude tests. Draw detailed E-R diagram for the same..
What is argument objects in javascript & how to get the type of arguments passed to a function?
Explain unescape() in javascript?
Give code Email Checking
What is the difference between var and let?
Is javascript necessary?
What is a function object?
What causes memory leaks?
What does javascript do?
Where can I learn javascript?
What is the difference between java and java script?