programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# Largest numbers

Greenhorn
Posts: 1
int A,B,C 3 variables is there.when we are giving input values of these three variables..How to find the largest number.
pls send some logic of the code.

Ranch Hand
Posts: 118
Hi,
Check This.

math.max(math.max(a,b),c)

[ January 16, 2006: Message edited by: Sri Ram ]

Sheriff
Posts: 14691
16
Sri meant using the Math class (notice the capital letter )

You could simply use the '<' or '>' operators instead.

Ranch Hand
Posts: 95

Originally posted by rk chowdary:
int A,B,C 3 variables is there.when we are giving input values of these three variables..How to find the largest number.
pls send some logic of the code.

Here's a crude way to do it:
Logic:
int a = arg[0]
int b = arg[1]
int c = arg[2]

int largest = a
if (b> largest) {largest =b}
if (c > largest) {largest = c}
print largest.

 This parrot is no more. It has ceased to be. Now it's a tiny ad: The WEB SERVICES and JAX-RS Course https://coderanch.com/t/690789/WEB-SERVICES-JAX-RS