find the smallest integers

Discussion in 'Java' started by Jeremy, Feb 8, 2007.

  1. Jeremy

    Jeremy Guest

    the program to find smallest of several integers, then it assume that first
    value read specific the number of values to input rom the users.

    If i can get the value specify the input from the reader, then i know i can
    finish the other let me know.
    import java.util.Scanner;
    public class Input

    {
    public static void main (String args[])
    {
    Scanner input = new Scanner(System.in);
    int counter=1;
    int smallestnumber=0;
    int values=0;
    int number=0;

    {
    System.out.printf("Indicate how many values you want to input:");
    values =input.nextInt();

    while ( counter<=values)
    {
    System.out.println();
    ++counter;
    values=number;

    }


    System.out.printf("Indicate numbers you want to calcuate for smallest
    integer:");
    number =input.nextInt();
    while (values==number)
    {
    number=smallestnumber;
    if (smallestnumber<=number)
    {

    System.out.println(smallestnumber);
    }
    }






    }
    }
    }
     
    Jeremy, Feb 8, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    10
    Views:
    5,895
    Andrea Griffini
    Feb 26, 2006
  2. Code4u
    Replies:
    4
    Views:
    2,965
    Stephen Howe
    Jul 13, 2005
  3. ken
    Replies:
    1
    Views:
    387
  4. Eugeny Myunster
    Replies:
    16
    Views:
    9,558
    user923005
    Apr 28, 2008
  5. Wybo Dekker
    Replies:
    1
    Views:
    621
    Yukihiro Matsumoto
    Nov 15, 2005
  6. vdvorkin
    Replies:
    0
    Views:
    606
    vdvorkin
    Feb 10, 2011
  7. vdvorkin
    Replies:
    3
    Views:
    1,078
    vdvorkin
    Feb 14, 2011
  8. Sunny
    Replies:
    7
    Views:
    306
    William James
    Nov 27, 2008
Loading...