Results 1 to 4 of 4

Thread: simple increment problem....?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Location
    liverpool
    Posts
    9

    simple increment problem....?

    Hi,
    Trying out how to increment a integer by accumulations of 2. I know as a single integer the code would involve '2++' etc but the sum i need to do is for eg. 2*2*4*4*6*6*8*8 etc.

    Thanks...

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    While I don't entirely follow, the following are used to increment/decrement values :

    2+=2 //result 4
    2-=2 //result 0
    2*=3 //result 6
    2/=2 //result 1

    Does this help you?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Code:
    int ans = 1;
    for (int i = 2; i <= 10; i++2)
    {
       ans = ans * i * i;
    }
    Last edited by marnitzg; Nov 15th, 2002 at 01:10 PM.

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Location
    liverpool
    Posts
    9
    thanks alot it works fine now

    old andrew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width