import  javax.swing.JOptionPane;

/**
*
* @author http://victorbyte.net
*/
public class Main {

/**
* @param args the command  line arguments
*/
public static void main(String[] args) {
int[] numInt = new int[5];
int maxNum = 0;
int minNum = 0;

for (int i = 0; i < numInt.length; i++) {

numInt[i] =  Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter a  number"));

if (i == 0 || numInt[i] > maxNum) {
maxNum =  numInt[i];
}

if (i == 0 || numInt[i] < minNum) {
minNum = numInt[i];
}
}

JOptionPane.showMessageDialog(null, "The highest number is " + maxNum +  "\nThe lowest number is " + minNum);
}

}

Tags:

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

blog comments powered by Disqus