fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char s[1050];
  6. int i;
  7. while(gets(s))
  8. {
  9. int count=0, sum=0, len=strlen(s);
  10. if(s[0]==0 && len==1) return 0;
  11.  
  12. for(i=0; i<len; i+=2) sum+=s[i]-'0';
  13. for(i=1; i<len; i+=2) sum-=s[i]-'0';
  14. for (i = 0; s[i]; i++)
  15. {
  16. if (s[i] != ' ') s[count++] = s[i];
  17. }
  18. s[count] = '\0';
  19. if(sum%11==0) printf("%s is a multiple of 11.\n", s);
  20. else printf("%s is not a multiple of 11.\n", s);
  21. }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 10320KB
stdin
            112233              
    00000000030800
   2937                           
                      323455693                 
          5038297          
          00000112234     
00112            
0
stdout
112233 is a multiple of 11.
00000000030800 is a multiple of 11.
2937 is a multiple of 11.
323455693 is not a multiple of 11.
5038297 is a multiple of 11.
00000112234 is not a multiple of 11.
00112 is not a multiple of 11.
0 is a multiple of 11.