Hi, I am trying to have my program output all the even numbers from 0-500 displaying 5 numbers per line on a
JOptionPane.showMessageDialog screen. I can get it to output one number each output box but you need to keep hitting ok. I was thinking of using modulus in an if loop.
Something like
If (count % 5 == 0);
temp = temp + "/n";
maybe?
Here is what I have at the moment. I am really stuck on how to implement the return character.
import javax.swing.JOptionPane;
public class Counting
{
public static void main(String args[])
{
String temp;
int count=0;
while (count <= 400)
{
JOptionPane.showMessageDialog(null, "The output is "+ count);
count = count + 2;
}
if (count % 5 == 0);
temp = temp + "/n";
System.exit(0);
}
}
Thanks.