#12383: yee


warren (warren(爽啦))

School : 臺北市私立延平高級中學
ID : 60242
IP address : [203.72.178.252]
Last Login :
2018-09-07 17:15:43
d235. 10929 - You can say 11 -- UVa10929 | From: [203.72.178.252] | Post Date : 2017-07-20 14:44

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
 
 int i,sum;
 char n[1001];
 while(cin>>n)
 {
  if(n[0]=='0') break;
  for(sum=i=0; n[i]!='\0'; i++)
  {
   sum=sum+(n[i]-'0');
   i++;
   if(n[i]=='\0') break;
   sum=sum-(n[i]-'0');
  }
  if(sum%11==0) printf("%s is a multiple of 11.\n",n);
  else printf("%s is not a multiple of 11.\n",n);
 }
 
 return 0;
}
 
ZeroJudge Forum