# Thread: printing the max number

1. ## printing the max number

Hello

I have a array with 4 numbers, I can't figure out how I can find and print the maximum number in the array. What is the best way of doing this?

2. What have you tried?

3. I can't figure it out

4. Really?

Consider this list of four integers by systematically reading them from one direction, e.g., left to right:
2 4 6 2

What is the maximum number? How did you know it was the maximum?

5. Code:
```for(i=0; i<4; i++){
if(array[i]>maxvalue)
maxvalue = array[i];```
This sounds like homework, so make sure you understand it.

6. osxd00d, read our homework policy.

7. Thanks, now that I see it it looks so simple

8. Originally Posted by arya6000
Thanks, now that I see it it looks so simple
Yeah, getting your homework done by someone else is rather simple.

9. Originally Posted by arya6000
Thanks, now that I see it it looks so simple
Well, it is, but when you have someone else do your hw for you, it's going to catch up with you.

10. Basically, find the highest number (how would you do it in reality of you had a bunch of numbers to look at?), then print out that number when you find it.