#include <iostream>
using namespace std;
int main(){
ios::sync_with_stdio(0);
unsigned int n;
while(cin>>n){
if(!n)
return 0;
cout<<"The parity of ";
int ans=0,beg=__builtin_clz(n);
for(int i=31-beg;i>=0;i--){
int t=(n&(1<<i))?1:0;
cout<<t;
ans+=t;
}
cout<<" is "<<(ans)<<" (mod 2)."<<endl;
}
}
using namespace std;
int main(){
ios::sync_with_stdio(0);
unsigned int n;
while(cin>>n){
if(!n)
return 0;
cout<<"The parity of ";
int ans=0,beg=__builtin_clz(n);
for(int i=31-beg;i>=0;i--){
int t=(n&(1<<i))?1:0;
cout<<t;
ans+=t;
}
cout<<" is "<<(ans)<<" (mod 2)."<<endl;
}
}
Comments
Post a Comment