64 617
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #3515 in Java | JSP | JSF for Y mukundareddy

Question #3515
1) Write a program to print n even numbers till?
Expert's answer
import javax.sound.midi.SysexMessage;
import java.util.Random;


public class EvenNumberPrinter
{
public static void main(String[] args)
{
Random generator = new Random();
int n = generator.nextInt(20) + 10;
System.out.println("The total amount of numbers (n) = " + n);
System.out.println("The even numbers from 0 to " + n + ":");
for (int i = 0; i < n; i++)
if (i % 2 == 0)
System.out.print(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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions