simple C puzzle
how will u check the relation of two numbers (greater or lesser or equal to) without using RELATIONAL OPERATORS??????;-);-);-)
Replies
-
Saandeep SreerambatlaA small idea to find whether greater or smaller.
if (x/y)
Printf ("X is greater")
else
Printf("y is greater")
This is a small idea ,i dont know how to check for equal case.
*thinking* -
yadavundertaker mohitif(x/y==1)
{
printf("x=y");
else
{
if(x/y==0)
printf("y is greater");
else
printf("x is greater");
}
} -
vignesh1988iHMMMM... ๐ ok.. think think ..... for the second person ok... u have tried .. good.. '==' is is also a relational operator.......๐๐๐
-
arun.aj/*a and b declared and defined*/
if(!(a-b))printf("equal");
else if(a/b)printf("a is greater");
else printf("b is greater");
๐ -
Saandeep Sreerambatlaarun.aj/*a and b declared and defined*/
if(!(a-b))printf("equal");
if(a/b)printf("a is greater");
else printf("b is greater");
๐
Good one dude ๐ -
yadavundertaker mohitarun.aj/*a and b declared and defined*/
if(!(a-b))printf("equal");
else if(a/b)printf("a is greater");
else printf("b is greater");
๐
you have IQ like shikamaru...so you are his fan...
great... -
yadavundertaker mohitvignesh1988iHMMMM... ๐ ok.. think think ..... for the second person ok... u have tried .. good.. '==' is is also a relational operator.......๐๐๐
thanks for telling ....i have a tight hand in C.. -
Sahithi Pallaviarun.aj/*a and b declared and defined*/
if(!(a-b))printf("equal");
else if(a/b)printf("a is greater");
else printf("b is greater");
๐
wonderfull !! Good one.. -
arun.aj
lol!! just a fan ๐yadavundertakeryou have IQ like shikamaru...so you are his fan...
great... -
vignesh1988ihmmmm... keep it up... ๐๐ cool,,, so the next constraint for the same problem am gonna give u....
without using '/' operator how will u do???๐ฒ -
arun.aj/*declaring defining a and b... using stdio.h and stdlib.h*/
/*brute force ๐*/
if(!(a-b)){printf("equal"); exit(0);}
while(a && b)
{
a--;b--;
}
if(a)printf("a is greater");
else printf("b is greater");
๐ -
vignesh1988iHmmmm ..... very good man.... good good ๐ ๐ so the next constraint , ok by using single if statement how will u do??? in a single 'if' we can finish comparing.... ๐๐
-
Sahithi Pallavi
Awesome man..! Great one..! ๐arun.aj/*declaring defining a and b... using stdio.h and stdlib.h*/
/*brute force ๐*/
if(!(a-b)){printf("equal"); exit(0);}
while(a && b)
{
a--;b--;
}
if(a)printf("a is greater");
else printf("b is greater");
๐
You are reading an archived discussion.
Related Posts
I had a mountain of spare computer parts around, so I decided to turn them into a touchscreen jukebox project. As the project progresses, I've been adding more and more...
I want to get started with C, any recommendations people.
Alrighty folks,
Here's some tweaking you can use to get your 'fading' & 'buttonless' Google search engine-
1. Head over to Google.com [ make sure you are on Google dot...
I've been noticing the mushrooming of entrepreneurship cells [aka e-cells] at numerous engineering colleges. Surprisingly, these ecells are run by professors who aren't entrepreneurs themselves.
I'm wondering how effective are...
I've a new view to look at the software piracy. While lot of software companies lose huge amounts of revenues through software piracy, there's another part to it.
It results...