can someone help me find something that i can depend on making sourcecodes using while, do while, for while...thx

A simple counting program.

For example, to get the factorial of n where n is in int. The result is the final value of fac.

long fac=1;
int i=1;
while ( i<=n ) { // the condition for execution of the loop
fac *= i;  //  the previous factorial (factorial of i-1)is multiplied by the current i
i++;  // i has one increment
}
long fac=1;
int i=1;
do{
fac *= i; //  the previous factorial (factorial of i-1)is multiplied by the current i

i++; // i has one increment
}while ( i<=n ) // the condition for execution of the loop
long fac=1;
for (int i=1; i<=n; i++) // the control variable i is initiated with 1
fac = fac*i; //  the previous factorial (factorial of i-1)is multiplied by the current i

also see http://download.oracle.com/javase/tutorial/java/nutsandbolts/while.html

I guess these are the basics of any language. Y do u have to ask people to write code for u here?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.