10929 - You can say 11

#include<stdio.h>

#include<string.h>

int main()

{

    char str[1005];

    long long int i,a,rem,sum;

    while(gets(str))

    {

        if(strcmp(str,"0")==0)

        {

            break;

        }

        a=strlen(str);

        rem=0;

        for(i=0; i<a; i++)

        {

            sum=rem*10+str[i]-48;

            rem=sum%11;

        }

        if(rem==0)

        {

            printf("%s is a multiple of 11.\n",str);

        }

        else

        {

            printf("%s is not a multiple of 11.\n",str);

        }

    }

    return 0;

}


0 comments: (+add yours?)