Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TwoSmallest {
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- System.out.println("Terminating value?");
- double tValue = IO.readDouble();
- double smallest = 0;
- double smallest2 = 0;
- double x = 0;
- int numx = 0;
- System.out.println("Enter first number");
- x = IO.readDouble();
- smallest = x;
- smallest2 = x;
- while (x != tValue)
- {
- System.out.println("Enter numbers");
- x = IO.readDouble();
- if (x < smallest)
- {
- smallest2 = smallest;
- smallest = x;
- }
- else if (x < smallest2)
- {
- smallest2 = x;
- }
- }
- IO.outputDoubleAnswer(smallest);
- IO.outputDoubleAnswer(smallest2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement