fork download
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5. char n[1001];
  6. int i;
  7. int somap, somai;
  8.  
  9. //11233
  10.  
  11. gets(n);
  12.  
  13. while (!(n[0] == '0' && n[1] == '\0')){
  14. i = 0;
  15. somap = 0;
  16. somai = 0;
  17.  
  18. while (1){
  19. if (n[i] == '\0')
  20. break;
  21.  
  22. somai += n[i] - 48;
  23.  
  24. i++;
  25.  
  26. if (n[i] == '\0')
  27. break;
  28.  
  29. somap += n[i] - 48;
  30.  
  31. i++;
  32. }
  33.  
  34.  
  35. if (somap % 11 == somai % 11){
  36. printf("%s is a multiple of 11.\n", n);
  37. }
  38. else{
  39. printf("%d %d\n", somap, somai);
  40. printf("%s is not a multiple of 11.\n", n);
  41. }
  42.  
  43. gets(n);
  44. }
  45.  
  46. return 0;
  47. }
Success #stdin #stdout 0.02s 1724KB
stdin
000011
112233
30800
2937
323455693
5038297
112234
0
stdout
000011 is a multiple of 11.
112233 is a multiple of 11.
30800 is a multiple of 11.
2937 is a multiple of 11.
323455693 is a multiple of 11.
5038297 is a multiple of 11.
7 6
112234 is not a multiple of 11.