aspose file tools*
The moose likes Beginning Java and the fly likes Largest numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Largest numbers" Watch "Largest numbers" New topic
Author

Largest numbers

rk chowdary
Greenhorn

Joined: Jan 16, 2006
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.
Sri Ram
Ranch Hand

Joined: Oct 03, 2005
Posts: 118
Hi,
Check This.

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


[ January 16, 2006: Message edited by: Sri Ram ]
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Sri meant using the Math class (notice the capital letter )

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


[My Blog]
All roads lead to JavaRanch
Adam Price
Ranch Hand

Joined: Nov 11, 2005
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Largest numbers
 
Similar Threads
type casting error!
Java code help!!!!
Do the Taliban smoke the opium too?
Program Problem
Initialization Question