By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,881 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

How to add int_max and int_min in this loop?

P: 64
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]
Feb 22 '07 #1
Share this Question
Share on Google+
3 Replies


P: 96
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]
Feb 22 '07 #2

P: 64
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.
Feb 22 '07 #3

P: 64
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?
Feb 22 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.