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

What is string concatenation in c?

1038


What is meant by inheritance?

1057


Explain the use of 'auto' keyword in c programming?

1077


What is union in c?

1073


I have seen function declarations that look like this

999


What does double pointer mean in c?

1091


What is character constants?

1140


What is the difference between call by value and call by reference in c?

1122


can any one provide me the notes of data structure for ignou cs-62 paper

2130


Why c is called free form language?

982


What is c programing language?

1051


Explain the difference between strcpy() and memcpy() function?

957


Write a program to generate random numbers in c?

1058


What are categories used for in c?

1045


Explain what are run-time errors?

1045