Monday, 29 September 2014

WAP to use Invert Function

#include<conio.h>
#include<stdio.h>
unsigned invert(unsigned, int ,int);
void main()
{
clrscr();
unsigned a;
int b,c;
printf("\n\t Enter no. value of Unsigned , int and int ");
scanf("%d%d%d",&a,&b,&c);
printf("\n\tThe result : %d",invert(a,b,c));
getch();
}
unsigned invert(unsigned x,int p,int n)
{
return x^(~(~0<<n)<<p+1-n);

}

No comments:

Post a Comment

Please write your doubts