Results 1 to 2 of 2
  1. #1
    trill is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default Help with Prefix cnt

    Hi, I'm just wondering what cnt means? A java trainer I am working on put it in the answer to a puzzle that I was working on, and i don't know what it means..

    Java Code:
    static int factorial(int n)
    {
    int cnt = 2;
    int fact = 1;
    while(cnt <= n)
    {
    fact *= cnt;
    cnt++;
    }
    return fact;
    }
    Thanks.

  2. #2
    zoe
    zoe is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default

    It looks like it is just the name of the integer

    the 'int' specifies the data type of the variable - integer
    the 'cnt' is the name of it
    then you set the value to the variable

    its the same with int fact - its just the variable name

    Hope this helps

Posting Permissions

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