Write a java program to print all even numbers between 1 to 100 - using while loop
class App {
public static void main(String[] args) {
int n = 100;
int i=1;
System.out.println("All even numbers between 1 to 100:");
  while(i<=n){
    if(i%2==0){
      System.out.println(i);
    }
    i++;
  }
}
}
Comments
Leave a comment