Answer to Question #329765 in Java | JSP | JSF for Kei

Question #329765

Write a java program to print all even numbers between 1 to 100 - using while loop

1
Expert's answer
2022-04-17T07:40:52-0400


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++;
	    }
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS