write a java application that prints all even numbers from 2 to 50, with the aid of the following specification: start a new line after every multiple of 20.
Use for loop.
Save this program as evennums.java
1
Expert's answer
2012-05-09T10:58:49-0400
public class Main { public static void main(String[] args) { System.out.print("Even numbers from 2 to 50 are: "); for(int i=2;i<=50;i++){ if(i%2==0){ System.out.print(i+","); } if(i%20==0){ System.out.print("\n"); } } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment