Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int a[1000000];
- int main()
- {
- long long b,c,d,e,f,i,j,k,l;
- while(1)
- {
- cin>>b;
- c=0;
- d=0;
- i=0;
- if(b==0) break;
- while(b!=0)
- {
- c=b%2;
- a[i]=c;
- i++;
- if(c==1)
- d++;
- b=b/2;
- }
- printf("The parity of ");
- for(j=i-1; j>=0; j--)
- {
- printf("%d",a[j]);
- }
- printf(" is %d (mod 2).\n",d);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment