answersLogoWhite

0

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);

}

User Avatar

Wiki User

9y ago

Still curious? Ask our experts.

Chat with our AI personalities

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: How do you find the largest of 3 numbers in computer programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp