Product of odd integers 1-30

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Product of odd integers 1-30
jeedai
CZ Newbie
jeedai has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 2
Points: 86
   
I'm new to JS and am trying to write a script that gives the product of all the odd integers 1-30. PLEASE HELP!


This is what I have so far:

SCRIPT LANGUAGE = "JavaScript"
var x, max, product;
var x = 1;
var max = 30;
var product = product *= x++;

while(x<=max )
if(x%2==1)
{
product *= x++;

}

document.write( "The product is: " + product );
/SCRIPT


I'm pretty sure I'm in the right area here but I'm starting to get a headache. Please help.


p.s. I had to remove the <> tags so I could submit this...



Back to top Reply with quote
#2   re: Product of odd integers 1-30
Kelly_Hero
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
usa.gif southcarolina.gif
Occupation: Web Developer
Age: 59
Gender: Female
Website:
Status: Offline
Joined: Aug 20, 2003
0.49 posts per day
Posts: 3765
Points: 351,412
   
Sorry, I'm not a Javascript guru either. Here are a couple of links that I found that might steer you in the right direction.

[ Register or login to view links on this board.]
[ Register or login to view links on this board.]

Hope it helps.

Kelly



Back to top Reply with quote
#3   
jeedai
CZ Newbie
jeedai has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Mar 01, 2004
0.00 posts per day
Posts: 2
Points: 86
   
thanks



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum