To find the largest of three numbers you must first find the largest of two numbers:
int max (int a, int b) { return a>b?a:b; // or, equivalently: if (a>b) return a; else return b;
}
Now we can use this function to find the maximum of three:
int max3 (int a, int b, int c) {
return max (max (a,b), c);
}
Copyright © 2026 eLLeNow.com All Rights Reserved.