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 to toggle display an html element?

1043


What is unescape() function?

1100


How to show progress bar while loading using ajax call?

1014


What is a method in javascript?

982


How do I open javascript in chrome?

902


What does js stand for?

895


Which built-in method calls a function for each element in the array?

1034


If you need to hide the javascript code from the older browser versions, how will you perform it?

960


What is enum data type?

917


How to trigger a postback on an updatepanel from javascript?

901


How many functions are there in javascript?

903


What is prototype in javascript and how do you use it?

924


What is use strict in javascript?

920


Is a javascript script faster than an asp script?

950


What is dataview in javascript?

927