Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define C2D(v) ((v) - '0')
  4. #define MAX_LEN 10001
  5.  
  6. int main(void)
  7. {
  8.     char buf[MAX_LEN];
  9.     int r, sinal, p;
  10.    
  11.     while ((scanf("%s", buf) != EOF) && ((buf[0] != '0') || buf[1]))
  12.     {
  13.         for (r = p = 0, sinal = -1; buf[p]; p++)
  14.             r += (C2D( buf[p] ) * (sinal *= -1));
  15.         printf ("%s %s\n", buf, (r % 11 == 0 ? "is a multiple of 11." : "is not a multiple of 11."));
  16.     }
  17.    
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement