473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to add int_max and int_min in this loop?

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
3 2766
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
td0g03
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
td0g03
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

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

Similar topics

4
by: Roopa | last post by:
Hi, Is there anything wrong with this code ? #include <stdio.h> int main() { int i=32999;
7
by: vikky | last post by:
hi all, Out of sheer curosity, I decided to initialize an integer with a number bigger than INT_MAX, however I still am not able to justify its output. Here is the program : #include<stdio.h> ...
2
by: Marlene Stebbins | last post by:
I am entering numbers into my program from the command line. I want to check whether they are > INT_MAX. Sounds simple, but I've discovered that if(x <= INT_MAX) { /* use x in some calculation...
8
by: A. Farber | last post by:
Hello, I have this simple program: #include <stdio.h> #include <stdlib.h> int main() { char *args = "2162508224"; printf("args=%s, atoi=%lu, atol=%lu\n",
41
by: p_cricket_guy | last post by:
Please see this test program: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <limits.h> 4 5 int main (void) 6 { 7 int y = -2147483648; 8 int x = INT_MIN;
24
by: Yevgen Muntyan | last post by:
Hey, Is it correct that number of value bits in int and unsigned int representation may be the same? If it is so, then INT_MIN may be -(INT_MAX+1) (in mathematical sense), i.e. abs(INT_MIN) is...
26
by: Yevgen Muntyan | last post by:
Hey, It was mentioned elsewhere that printf("%d", INT_MAX); is implementation-defined. Why? Is it because INT_MAX value is implementation-defined so output depends on implementation, or is it...
30
by: viza | last post by:
Hi all int i= INT_MIN; unsigned int u= -i; Is u guaranteed to have the absolute value of INT_MIN? Why it might not: -i has type (int), and -INT_MIN might be more than INT_MAX.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.