CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   cnt prefix in java? (http://www.codingforums.com/showthread.php?t=48726)

vhrocker5150 12-09-2004 10:35 PM

cnt prefix in java?
 
Im 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 dont know what it means..

static int factorial(int n)
{
int cnt = 2;
int fact = 1;
while(cnt <= n)
{
fact *= cnt;
cnt++;
}
return fact;
}

any help would be appreciated. thanks.

anarchy3200 12-09-2004 10:49 PM

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

vhrocker5150 12-09-2004 11:21 PM

thanks a lot for clearing that up.

KeZZeR 12-10-2004 12:56 AM

Yup, as anarchy said, i'd imagine cnt is a short way of saying count since you're incrementing every time you iterate through the while loop :)


All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.