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 are static variables in c?

1089


What extern c means?

1011


What is merge sort in c?

1053


Define VARIABLE?

1177


What is new line escape sequence?

1361


How do you use a pointer to a function?

1094


By using C language input a date into it and if it is right?

1088


What is self-referential structure in c programming?

1227


How do I determine whether a character is numeric, alphabetic, and so on?

1140


How do you write a program which produces its own source code as output?

1128


What are type modifiers in c?

1061


What is difference between class and structure?

1123


What is the right type to use for boolean values in c? Is there a standard type?

1020


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

2209


Explain b+ tree?

1079