... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...

Tuesday, December 24, 2013

UVA-11879 :: Multiple of 17

#include <stdio.h>
#include <string.h>

int main ()
{
     int n , i, x,b ,a ,sum ;
     char str [120] ;

      while ( gets (str) )
      {
          i =0 ; x =0 ; b = strlen (str) ;

          if (str[0] == '0' && b == 1 )  break  ;

          sum =0 ;
     for (i =0 ; i<= b -1 ; i++)
          {
               sum = x *10 + (str [i] - '0') ;
               x = sum %17 ;
          }

           if (x == 0) printf ("1\n") ;
          else printf ("0\n") ;

      }

return 0 ;
}