Find the smallest number using while loop in java 2011


Code:
import javax.swing.*;
public class HighestNum {
public static void main (String args[])
{
int value = 0,number=0,smallest = 0;
while (value<10)
{
value++;
number = Integer.parseInt(JOptionPane.showInputDialog("Enter a number "+value+":"));
}
if (number <= smallest)
smallest=number;
else
smallest = smallest;
String msg="The smallest number is :"+smallest;
JOptionPane.showMessageDialog(null,msg);
}
}


Sponsored Links