10929-you can say 11
Time limit:3.000 seconds
Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem &problem=1870
Introduction to the problem
Your job is, given a positive number N, determine if it is a multiple of eleven.
Description of the input
The input is a file such so each line contains a positive number. A line containing the "number 0 is the" end of the input. The given numbers can contain up to 1000 digits.
Description of the output
The output of the program shall indicate, for each input number, if it is a multiple of eleven or.
Sample Input:
112233
30800
2937
323455693
5038297
112234
0
Sample Output
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.
112234 is not a multiple of 11.
Method 1: Start mod 11 directly from single-digit digits.
/*0.026s*/
#include <cstdio>
#include <cstring>
char s[1005];
int main (void)
{
int remainder;
while (gets (s), strcmp (S, "0"))
{
remainder = 0;
for (int i = 0; s[i]; i++)
remainder = (remainder * + (s[i) &))%;
if (remainder) printf ("%s is not a multiple of 11.\n", s);
else printf ("%s is a multiple of 11.\n", s);
}
return 0;
}