int biggest(int a, int b) {
int result;
(a<b)?(result=b):(result=a);
return result;
}


Thanks,
http://supermanhelp.com




________________________________
From: Anup Joshi <[email protected]>
To: [email protected]
Sent: Sat, 26 December, 2009 4:27:53 PM
Subject: [c-prog] Getting Biggest number of two.

  
Hello friends,
I wanted to find biggest number of given two numbers without using the 
loop statement, the if-conditional, or the ternary operator ?:. One way 
i could do this was with the following code:

int biggest(int a, int b) {
int result;

(a<b) && (result = b); // b is bigger
(a>b) && (result =a); // a is bigger
(a==b) && (result = a) // both are equal

return result;
}

this code works for positive as well as negative ints.
i wanted to know if there was any other way to find the biggest number 
of the two, by using any other c operator or snippet.

Thanks & Regards :-)

anup

 


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

[Non-text portions of this message have been removed]

Reply via email to