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.



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

Post New Answer

More JavaScript Interview Questions

What is the Infinity property used for in Javascript?

0 Answers  


How will you create new object in javascript?

0 Answers  


What is unshift method in JavaScript?

0 Answers  


What are the javascript objects?

0 Answers  


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

0 Answers  


What is the difference between the operators '==' and '==='?

0 Answers  


What will be the output of the following code? //nfe (named function expression) var Foo = Function Bar() { return 7; }; typeof Bar();

1 Answers  


How do you check if an object is an array or not?

0 Answers  


How to open a window with no toolbar, but with the location object?

0 Answers  


What are self invoking functions?

0 Answers  


What is the difference between innerhtml and append() in javascript?

0 Answers  


Can you run javascript in notepad?

0 Answers  


Categories