Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to compare 2 numbers without using logical
operators?

Answer Posted / faceless

main()
{
int result, sign_bit_num;
unsigned int x, y;

sign_bit_num = sizeof(int)*8 ;

result = x-y;

if (result) {
result = result >> (sign_bit_num-1);

if (result) {
printf("x less than y");
} else {
printf("x greater than y");
}
} else {
printf("equal");
}

Is This Answer Correct ?    14 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c language still used?

933


What are structures and unions? State differencves between them.

1100


Why is c so popular?

1118


Is c still used?

999


What is calloc in c?

1080


What is the best style for code layout in c?

1048


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

1223


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

2058


What is the collection of communication lines and routers called?

1055


What are two dimensional arrays alternatively called as?

1133


What is difference between union All statement and Union?

1059


What are the advantages of using Unions?

1067


What is echo in c programming?

964


Not all reserved words are written in lowercase. TRUE or FALSE?

1181


Using which language Test cases are added in .ptu file of RTRT unit testing???

4217