Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How would you check if a variable is null/undefined?

1041


Which built-in method combines the text of two strings and returns a new string?

1172


What is the javascript function?

1088


Can array in javascript be extended?

945


How to create function in JavaScript?

1140


How to use one javascript function for multiple input fields?

2137


How do you implement Ajax using hide() function in JQuery?

2331


Where do I put javascript code in html?

1096


Mention what is the disadvantage of using innerhtml in javascript?

1052


How does javascript work?

1017


What is a callback url?

944


What does two exclamation marks mean in javascript?

1049


What is global variable in javascript?

973


What is the ‘Strict’ mode in JavaScript and how can it be enabled?

1067


What does the isNaN() function?

1040