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
What is the difference between an array and an object?
What are the ways of making comments in javascript?
What are self Executing Functions?
How to disable an html object ?
What is shift() method in javascript?
How can I request data from the server without reloading the page in the browser?
What is event target in javascript?
Do I need to install javascript?
What is escape & unescape String functions in JavaScript?
Please write the Code of simple javascript calculator withot eval() function
Write a main method that prompts the user to enter the starting population, birth and death rates, and the number of years. The input birth and death rates cannot be negative, the starting population cannot be less than 2, and the number of years greater than 0. If the user enters an invalid value, this program will prompt user to re-enter the value until a valid value has been read. When all input values are valid, call on the methods above to compute estimated population and print result.
how to validate the date(dd/mm/yyyy)using regular expression in javascript? It should also satisfy the leap year feb 29 problem. Please help me.
How much time it will take to learn javascript?
what is a dataset
Who is the world famous hacker?