#include <bits/stdc++.h> using namespace std; int main() { int n; while (true){ cin>>n; if (n==0){ // 如果n==0 break; } string s=" "; // 初始化字串s int temp=n; // 將n的值存入temp while (temp>0){ s=(temp%2==0?"0":"1")+s; // 判斷 temp 的奇偶,若為偶數則加入'0',奇數則加入'1' temp/=2; // 將temp除以2 } int count=0; for (int i=0;i<s.length();i++){ if (s[i]=='1'){ // 如果s[i]為'1' count++; } } cout<<"The parity of "<<s<<"is "<<count<<" (mod 2)."<<endl; } return 0; }