Bigger of two numbers :Sachin Sir
4 posters
Page 1 of 1
Bigger of two numbers :Sachin Sir
find the bigger of two nmbers without using any built in function or reklational operator
ballu- Posts : 58
Join date : 2009-02-01
Re: Bigger of two numbers :Sachin Sir
#include<stdio.h>
main()
{
int arr[]={3,4};
printf("%d",arr[arr[1]/arr[0]]);
getchar();
}
//take the nos in array and do the above thing...
main()
{
int arr[]={3,4};
printf("%d",arr[arr[1]/arr[0]]);
getchar();
}
//take the nos in array and do the above thing...
$corpion- Posts : 25
Join date : 2009-01-30
Age : 37
@scorpion
heres my solution
int x=3,y=4;
arr[]={y,x}
printf("%d",arr[(x-y)&&2<<31]);
int x=3,y=4;
arr[]={y,x}
printf("%d",arr[(x-y)&&2<<31]);
ballu- Posts : 58
Join date : 2009-02-01
Re: Bigger of two numbers :Sachin Sir
hey ballu bhai..is it working..cause in dev dpp m gettin only 4 as answer...in all the cases..i.e even wen m takin x as 5...
wats the logic basically??
wats the logic basically??
$corpion- Posts : 25
Join date : 2009-01-30
Age : 37
@DUBEY
dubey your answer fails for negative no what if no are -4 and -5
mnnit.rahul- Posts : 51
Join date : 2009-02-01
Similar topics
» Leyland Numbers
» Practical Numbers
» largest palindrome made from the product of two 3-digit numbers.
» Practical Numbers
» largest palindrome made from the product of two 3-digit numbers.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|