Pages: [1]   Go Down
Author Topic: Simple math question?  (Read 339 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How do I find the largest of 3 numbers?

int dist1 = 8;
int dist2 = 5;
int dist3 = 10;
« Last Edit: March 07, 2009, 08:59:23 pm by kennyj » Logged

Indiana
Offline Offline
Full Member
***
Karma: 1
Posts: 234
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
int maxValue = max(dist1,max(dist2,dist3));

See here: http://arduino.cc/en/Reference/Max
Logged

Pages: [1]   Go Up
Jump to: