# I can't figure this out

• 07-18-2007, 08:36 PM
silvia
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
• 07-19-2007, 04:27 AM
Eranga
Are worried about multiplying negative odd numbers?

int can hold negative numbers at all.
• 07-19-2007, 06:33 PM
cruxblack
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 :D

logic comes first, coding comes later :p
hope this helps sylvia:D
• 07-20-2007, 04:38 AM
Eranga
Design comes first.:p

Quote:

Originally Posted by cruxblack
logic comes first, coding comes later :p