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...

without using arithmatic operator convert an intger variable
x into x+1

Answer Posted / vadivel t

#include<stdio.h>

void main()
{
int no;
int size, i;

printf("ENTER THE NO: ");
scanf("%d",&no);

size = sizeof(int) * 8;
for(i = 0; i < size; i++)
{
if((no & (0x01 << i)) != 0)
{
no = no^(0x01 << i);
}
else
{
no = no |(0x01 << i);
break;
}
}
printf("OUTPUT :%d \n", no);
_getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When was c language developed?

1195


Why should I prototype a function?

1185


Explain what are the standard predefined macros?

1114


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

1119


Where are the auto variables stored?

1144


main() { printf("hello"); fork(); }

1192


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

1164


What is meant by type specifiers?

1128


What is the use of the function in c?

1017


What is the use of bitwise operator?

1130


Function calling procedures? and their differences? Why should one go for Call by Reference?

1083


What is atoi and atof in c?

1084


what is the diffrenet bettwen HTTP and internet protocol

1835


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1980


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

2078