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

Printable View

- 07-18-2007, 09:36 PMsilviaI 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, 05:27 AMEranga
Are worried about multiplying negative odd numbers?

int can hold negative numbers at all. - 07-19-2007, 07:33 PMcruxblack
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

}

}

logic comes first, coding comes later :p

hope this helps sylvia:D - 07-20-2007, 05:38 AMEranga