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

Can I learn javascript without html?

891


To set all checkboxes to true using javascript?

1013


What are decodeuri() and encodeuri() functions in javascript?

960


What are the application of javascript?

902


Which symbol is used for comments in Javascript?

1713


What is the difference between HTMLCollection and NodeList?

1006


What Does JavaScript Void(0) Mean?

882


How to get complete current page url with javascript?

878


What are the difference between javascript and jquery?

1025


Can we create session in javascript?

865


How is it possible to get the total number of arguments that are passed to a function?

1046


Explain why asynchronous code is important in javascript?

972


Can you assign an anonymous function to a variable?

827


How to define a named function in JavScript?

935


What is output of “20” + 20 + 20 and “20” + ( 20 + 20)? In javascript?

958