Saturday, July 4, 2009

JAVA

“FORLOOP”

public class forloop {
public static void main(String[] args){
int x = 2;
for(x=2;x<=100;x=x+2) {
{
System.out.println(x);
}
}


“WHILELOOP”
public class whileloop {
public static void main(String args []){
int x=2;
while (x<=100){
{

System.out.println(x);
x=x+2;
}
}
}
}

“DOWHILELOOP”
public class dowhile {
public static void main (String args []){
int x=2;
do{
System.out.println(x);
x=x+2;
}while (x<=100);
}
}