">" And "&" operators in c
In c, the median operators include: And, Or, XOR, inversion, left shifting, and right shifting. bitwise operators are binary operators. The right shift operator is to move the binary digits of a number to the right n places, and the low digits of the right side are discarded. For the unsigned number, the high position is supplemented with 0, that is, in decimal format, each right shift is equivalent to dividing by 2, for example, a: 10101010 01010101 a> 10010101. For a signed number, some machines fill the blank part on the left with a signed bit, but some machines fill the blank part on the left with 0. For example, a: 11100111 00011101 a> 1110011 10001110 or 11110011 10001110. Source code in c: write the number 15 after the conversion to binary 1. # Include <stdio. h> int main () {int a = 15; int count = 0; while (a) {if (a % 2 = 1) count ++; a = a> 1;} printf ("% d", count); return 0;} result: 4 and operator: bitwise AND operator & is often used to block some binary bits. For example, a: 1001 0111 B: 1111 0000 a & B: 1001 0000 c program inputs a number into the number 1 after binary conversion. # Include <stdio. h> int main () {int count = 0; int num; scanf ("% d", & num); while (num) {count ++; num = num & (num-1);} printf ("% d \ n", count); return 0;} result: 4