need to find smallest int

This is a discussion on need to find smallest int within the C Programming forums, part of the General Programming Boards category; hi i need to make a program that uses a "while loop" to find the smallest of user defined integers ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    2

    need to find smallest int

    hi
    i need to make a program that uses a "while loop" to find the smallest of user defined integers
    can anyone give me a hint?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,794
    What you mean by "smallest of user defined integers"? As in you have say, an array of integers from user input, and you want to find the minimum element in this array?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    declare a variable min and initialize with first int
    compare min with every int. if an int is less than min, then assign min to that int
    when you have finished all the int, min should be the minimum

    the values can be stored in an array and use a while loop with an index

  4. #4
    Registered User
    Join Date
    Nov 2008
    Posts
    2
    thank u

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. NEED HELP READING FILE and PRINTING
    By geoffr0 in forum C Programming
    Replies: 4
    Last Post: 04-16-2009, 05:26 PM
  2. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  3. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 03:24 PM
  4. Replies: 2
    Last Post: 03-24-2006, 07:36 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 04:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21