- import java.util.*;
- public class main{
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- while(sc.hasNextLine())
- {
- String str = sc.nextLine();
- if(str.equals("0"))
- return;
- int odd=0, even=0;
- for(int i = 0; i < str.length(); i++)
- {
- if(i % 2 == 0)
- //even += Integer.parseInt(String.valueOf(str.charAt(i)));
- even += str.charAt(i) - 48;
- else
- //odd += Integer.parseInt(String.valueOf(str.charAt(i)));
- odd += str.charAt(i) - 48;
- }
- if(Math.abs(odd-even)%11 == 0)
- System.out.println(str + " is a multiple of 11.");
- else
- System.out.println(str + " is not a multiple of 11.");
- }
- }
- };
留言
張貼留言