954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Program to find the largest of given numbers without using loop

Hi all,

I got a new Java puzzle in which I have to find the largest of given numbers without using If loop,for loop or while loop..And you should not use any max() or min() functions.
Can anyone help me out in this?I want to know whether it is possible or not

Thanks in advance

Dave:(

dave_nithis
Newbie Poster
23 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 
Arrays.sort();
masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 
Arrays.sort();

No masijade...You should not use any functions.....:-/

dave_nithis
Newbie Poster
23 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

That is not what you said.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

But, okay, to play along, recursion and the tertiary operator.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 
But, okay, to play along, recursion and the tertiary operator.

Oh!!!Can you give me that recursion and tertiary program :-O

dave_nithis
Newbie Poster
23 posts since Oct 2007
Reputation Points: 10
Solved Threads: 0
 

No. Do your own work.

jasimp
Senior Poster
3,623 posts since Aug 2007
Reputation Points: 533
Solved Threads: 53
 

Hmmm.. Conditional operator..
Eg:

Class sr
{
public static void main(String arg[])
{
int a = 10, b = 3, x;
x = (a > b) ? a : b;
System.out.println(x);
}
}
Rizwana begum
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You