Sunday, January 25, 2009

//I have here very nice example for do while.

class dowhile
{ //class name
public static void main(String[] args) { //default method of java
int x = 1;
do {
System.out.println("Number: " + x);
x++;
}while(x<=10);


/*
Instructions

int x=1 is your declaration of your variable.
x<=10 is your condition til the condition becomes false.
x++ is your Incrementation in-order your x will move starts 1 to 10.
System.out.println("Number: " + x); is for display Number : 1 to 10.

*/

}
}


********OUTPUT**********













Download File

No comments:

Post a Comment

 

blogger templates | Make Money Online