Priyanka.. ideally u should not use any function calls to solve this
question.. because they internally might use conditional operators or if
else..
OR u can give your own definition of abs() function
With Regards
Saurabh
On Wed, Aug 24, 2011 at 11:06 PM, priyanka raju priyark...@gmail.comwrote:
@priyanka good one
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options,
ar[0]=a;
ar[1]=b;
printf(largest %d,ar[((a-b)31)0x1]);
On Wed, Aug 24, 2011 at 11:20 PM, kranthi kumar damarlakran...@gmail.comwrote:
@priyanka raju, Good solution...
--
Regards:
---
D Kranthi kumar
Computer Science Engg.
IIT Madras.
--
You received this
On Tue, Aug 23, 2011 at 7:50 PM, *$* gopi.komand...@gmail.com wrote:
int a,b;
int c=a-b;
c=c31;
c=c31; // hope you're trying for this. ;)
int x =c0x01;
a=a-x*c;
Thx,
--Gopi
On Tue, Aug 23, 2011 at 7:32 PM, Sanjay Rajpal srn...@gmail.com wrote:
@teja : use of comparison operator
*max=(ab)*a+(ba)*b;*
On Wed, Aug 24, 2011 at 7:32 PM, vikas singh shyguy1...@gmail.com wrote:
On Tue, Aug 23, 2011 at 7:50 PM, *$* gopi.komand...@gmail.com wrote:
int a,b;
int c=a-b;
c=c31;
c=c31; // hope you're trying for this. ;)
int x =c0x01;
a=a-x*c;
Thx,
--Gopi
On Tue,
On Wed, Aug 24, 2011 at 8:25 PM, praneethn praneeth...@gmail.com wrote:
*max=(ab)*a+(ba)*b;*
Not allowed ;) Read the constraints applied.
--
Thanks and Regards
VIKAS SINGH
MCA- final year
NIT DURGAPUR
email:
vikas.singh1...@gmail.com
shyguy1...@gmail.com
http://smrit.wordpress.com
--
You
Priyanka raju's solution will not work if a = 3 and b = -2
On Wed, Aug 24, 2011 at 8:28 PM, vikas singh shyguy1...@gmail.com wrote:
On Wed, Aug 24, 2011 at 8:25 PM, praneethn praneeth...@gmail.com wrote:
*max=(ab)*a+(ba)*b;*
Not allowed ;) Read the constraints applied.
--
Thanks and
oops! yes I was trying to find whether that number is negative or positive
by shifting the highest bit to oth location...
that is a typo error..
Thanks for pointing out!
On Wed, Aug 24, 2011 at 7:32 PM, vikas singh shyguy1...@gmail.com wrote:
On Tue, Aug 23, 2011 at 7:50 PM, *$*
@Anup: i think priyanka's solution would work for 3 and -2
On Wed, Aug 24, 2011 at 10:05 PM, *$* gopi.komand...@gmail.com wrote:
oops! yes I was trying to find whether that number is negative or positive
by shifting the highest bit to oth location...
that is a typo error..
Thanks for
Please explain with the example, I just joined, so I may have missed the
earlier details :)
On Wed, Aug 24, 2011 at 10:11 PM, Abhishek Yadav algowithabhis...@gmail.com
wrote:
@Anup: i think priyanka's solution would work for 3 and -2
On Wed, Aug 24, 2011 at 10:05 PM, *$*
It will work...
a=3
b=-2
max=(a+b+abs(a-b))/2
so
max=(3-2+abs(3-(-2)))/2
=(1+abs(5))/2
=(1+5)/2
=3
Same in case of min
--
cheers
priyanka
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
@priyanka raju, Good solution...
--
Regards:
---
D Kranthi kumar
Computer Science Engg.
IIT Madras.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To
Write a method which finds the maximum of two numbers You should not
use if-else
or any other comparison operator.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe
http://stackoverflow.com/questions/4772780/find-the-maximum-of-two-numbers-without-using-if-else-or-any-other-comparison-ope
On Tue, Aug 23, 2011 at 6:37 PM, Abhishek Yadav
algowithabhis...@gmail.comwrote:
Write a method which finds the maximum of two numbers You should not
use if-else
or
int a,b,c;
c=(ab)?a:b;
print(c);
On Tue, Aug 23, 2011 at 6:37 PM, Abhishek Yadav
algowithabhis...@gmail.comwrote:
Write a method which finds the maximum of two numbers You should not
use if-else
or any other comparison operator.
--
You received this message because you are subscribed to
@teja : use of comparison operator is not allowed.
Sanju
:)
On Tue, Aug 23, 2011 at 6:42 AM, teja bala pawanjalsa.t...@gmail.comwrote:
int a,b,c;
c=(ab)?a:b;
print(c);
On Tue, Aug 23, 2011 at 6:37 PM, Abhishek Yadav
algowithabhis...@gmail.com wrote:
Write a method which finds the
int a,b;
int c=a-b;
c=c31;
int x =c0x01;
a=a-x*c;
Thx,
--Gopi
On Tue, Aug 23, 2011 at 7:32 PM, Sanjay Rajpal srn...@gmail.com wrote:
@teja : use of comparison operator is not allowed.
Sanju
:)
On Tue, Aug 23, 2011 at 6:42 AM, teja bala pawanjalsa.t...@gmail.comwrote:
int a,b,c;
subtract the two check if its greater thn 0... c=a-b, if(c 1000 )
printf(a) else printf(b)
On Tue, Aug 23, 2011 at 7:50 PM, *$* gopi.komand...@gmail.com wrote:
int a,b;
int c=a-b;
c=c31;
int x =c0x01;
a=a-x*c;
Thx,
--Gopi
On Tue, Aug 23, 2011 at 7:32 PM, Sanjay Rajpal
18 matches
Mail list logo