Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main(void) {
- unsigned n, i = 0, z = 0;
- FILE *f;
- f = fopen("in.txt", "r");
- fscanf(f, "%u", &n);
- fclose(f);
- while (n >> i) {
- z += ~n & (1 << i);
- i++;
- }
- f = fopen("out.txt", "w");
- fprintf(f, "%u", z);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment