Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-18-2007, 09:36 PM
Member
 
Join Date: Jul 2007
Posts: 35
silvia is on a distinguished road
I can't figure this out
I Write an application that calculates the prduct of the odd integers from 1 to 15.
That is all it says...does it mean multiply all the odd numbers from 1 to 15? If so how do i do this....im not sure how to point out negative numbers.
Thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-19-2007, 05:27 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,065
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Are worried about multiplying negative odd numbers?

int can hold negative numbers at all.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-19-2007, 07:33 PM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
calculates da products of odd numbers from 1-15?

products in da mathematical terms of multiplication u mean rite?
so i supposed u want to make it like this?

1x3x5x7x9x11x13x15 = ?

if u wanna get da odd number from 1 - 15, u could use da modulus operator %, a loop, and an if logical statement

da main method should look like this inside i think

Code:
int x = 1; for(int i=1;i<=15;i++) { if((i%2)==1)//meaning that its an odd number { x = i*x;//or u could just write it x*=i to make it short, but its not really a good idea if ur still stufying, itll give u some hard time reading n doin ur logic } }
btw, just in case it didn't work, make sure u put da code inside da main method k, i already tested da code n it run out just fine

logic comes first, coding comes later
hope this helps sylvia
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-20-2007, 05:38 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,065
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Design comes first.


Quote:
Originally Posted by cruxblack View Post
logic comes first, coding comes later
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java assignment - couple methods don't know how to figure out Snowboardmylife New To Java 1 04-16-2008 11:52 AM
How can I figure out all the IPs on my network devices coco Networking 3 12-25-2007 05:10 AM
Seems so simple yet I can't figure it out! adamhaviland New To Java 1 11-03-2007 07:26 PM


All times are GMT +3. The time now is 03:58 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org