Write a java application that prints all even numbers from 2 to 50 with the aid specifications:
*start new line after every multiple of 20.
*use for loop.
1
Expert's answer
2011-06-01T13:25:41-0400
class PrintEvenNumbers { public static void main(String[] args) { int x=2; for (int i=2; i<=50; i+=2) { System.out.print(i+" "); x+=2; if (x>20) { System.out.println(); x=2; }; }; }; };
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