Home > Back-end > C language for beginners, bosses give directions
C language for beginners, bosses give directions
Time:10-09
CodePudding user response:
For example
int main (int arg c, const char * argv []) { Int x, p, n. The scanf (" % d ", & amp; X); The scanf (" % d % d ", & amp; P, & amp; N); Int v1=(x> (32 - p - 1)) & lt; <(32 - p - 1);//p of the left side (moves to the right and left, the right side of the qing 0) p Int v2=(1 & lt; V2=x % v2;//here more than using the method of simplified (can also shift) Int the v3=0;//p - part n For (int I=0; i<=p - n; I++) {//take out the number of bits to n and p in the V3=((~ ((x> (p - I)) & amp; 0 x00000001)) & amp; 0 x00000001) & lt; <(p - I) | v3; } Printf (" % d \ n ", v1 | v3 | v2); return 0; }