#include <stdio.h>
unsigned short int getbits(unsigned short value);
int main(int argc,char *argv[])
{
unsigned int short a;
printf("input an octal number:");
scanf("%o",&a);
printf("result:%o\n",getbits(a));
system("pause");
return 0;
}
unsigned short int getbits(unsigned short value)
{
unsigned int short z;
z = value & 0100000;
if (z == 0100000)
{
z = ~value + 1;
}
else
{
z = value;
}
return z;
}
|