Re: Program will add but cannot get it to multiply
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 21:30:51 GMT
On 31 Jan 2006 12:38:22 -0800, "shannon" <shannondingle@xxxxxxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
> int sum = 0;
>
> for ( int number = 0; number <=100; number +=2 )
> sum += number;
you mean this/
Try it with 9 and see if your code works. You may be pleasantly
surprised. A repeating multiplication is called a sum not a product.
What you are doing is very similar to computing a factorial and runs
into the same problem with the answers being too big.
see .http://mindprod.com/jgloss/factorial.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- Program will add but cannot get it to multiply
- From: shannon
- Program will add but cannot get it to multiply
- Prev by Date: Installation Woes (Windows)
- Next by Date: Re: Limit Single Instance
- Previous by thread: Re: Program will add but cannot get it to multiply
- Next by thread: Installation Woes (Windows)
- Index(es):