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 |
How to delete an array entry using javascript?
Are there any predefined constant provided by the browser with the key code values that can be reused?
why you used Java Script? Can it use for both client side and server side validation purpose?
12 Answers BeBo Technologies, HCL, Wipro,
What is a method in javascript?
Explain the role of deferred scripts in javascript?
What does the delete operator do in JavaScript?
What are JavaScript Data Types?
Why is java better than javascript?
What does it mean in javascript?
Explain the difference between call() and apply()?
Name some of the Javascript frameworks?
Consider the following code: 1 2 3 4 5 (function() { var a = b = 5; })(); console.log(b); what will be printed on the console?