How to add int_max and int_min in this loop?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • td0g03
    New Member
    • Jan 2007
    • 64

    How to add int_max and int_min in this loop?

    I been trying all day even made another thread, but no replies. My code is pretty simple, but just can't figure how to get the min and max of the users inputted in the loop. Not sure if I am explaining it clearly, but I'll go ahead and post the code.

    I did most of the questions alway, but I just like to know how to find the min and max.

    [code removed as per site FAQ]
    Last edited by MMcCarthy; Feb 22 '07, 06:58 AM. Reason: removed code as per site rules
  • rajesh6695
    New Member
    • Oct 2006
    • 96

    #2
    Declare two variables int max and min.

    store the first scaned input(i.e value of x) to the min and max.

    Inside the while loop check whether the scaned input(x) x>max or not if yes then store the x value in max

    once again check whether x is less than the min or not(x<min) if yes then store the x value in min..

    [code removed as per site FAQ]
    Last edited by MMcCarthy; Feb 22 '07, 06:59 AM. Reason: removed code as per site rules

    Comment

    • td0g03
      New Member
      • Jan 2007
      • 64

      #3
      Originally posted by rajesh6695
      Declare two variables int max and min.

      store the first scaned input(i.e value of x) to the min and max.

      Inside the while loop check whether the scaned input(x) x>max or not if yes then store the x value in max

      once again check whether x is less than the min or not(x<min) if yes then store the x value in min..
      Finally! I can't thank you enough. I can't believe it was that simple.

      Comment

      • td0g03
        New Member
        • Jan 2007
        • 64

        #4
        Originally posted by td0g03
        Finally! I can't thank you enough. I can't believe it was that simple.
        After looking at the code... I was thinking I did the same thing, but i didn't put in the { }. would that have mattered?

        Comment

        Working...