Hướng dẫn c++ program to check if a number is divisible by 3 - chương trình c ++ để kiểm tra xem một số có chia hết cho 3 không

Nhận một số Num và kiểm tra xem Num có chia hết cho 3 không.

Show

    Mẫu đầu vào 1:

    27

    Đầu ra mẫu 1:

    Chia hết cho 3

    Mẫu đầu vào 2:

    43

    Đầu ra mẫu 2:

    Không chia hết cho 3

    Chương trình hoặc giải pháp

    				
    			
    					
    #include<stdio.h>
    int main()
    {
    	int num;
    	printf("Enter a number: ");
    	scanf("%d"&num);
    	if(num%3==0)
    	{
    		printf("%d is divisible by 3",num);
    	}
    	else
    	{
    		printf("%d is not divisible by 3",num);
    	}
    	return 0;
    }
    			
    				
    			

    Giải thích chương trình

    Nhận đầu vào Num từ người dùng bằng cách sử dụng câu lệnh SCANF

    Kiểm tra xem phần còn lại của num chia cho 3 bằng 0 bằng cách sử dụng câu lệnh IF.

    Nếu là 0, thì in num là chia hết cho 3 bằng cách sử dụng câu lệnh printf.

    Khác in Num không chia hết cho 3 bằng cách sử dụng câu lệnh PRINTF.

    Đưa ra một số, nhiệm vụ là chúng tôi chia số cho 3. Số đầu vào có thể lớn và có thể không thể lưu trữ ngay cả khi chúng tôi sử dụng int.examples dài dài: & nbsp; & nbsp;
    Examples: 
     

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes

    Vì số đầu vào có thể rất lớn, chúng tôi không thể sử dụng N % 3 để kiểm tra xem một số có chia hết cho 3 hoặc không, đặc biệt là bằng các ngôn ngữ như C/C ++. Ý tưởng này dựa trên thực tế sau. & NBSP;
     

    Một số được chia cho 3 nếu tổng các chữ số của nó chia hết cho 3.

    Minh họa: & nbsp; & nbsp; 
     

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.

    Điều này hoạt động như thế nào? & NBSP; 

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.

    Dưới đây là việc thực hiện thực tế trên: & nbsp;
     

    C++

    #include<bits/stdc++.h>

    using namespace std;

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    5

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    8

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    0
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    3

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    5
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    6
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    0

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    3

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    6
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    7
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3 0 1 2 3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9 7

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Java

    9 0

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3 3 4 5

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    5

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0 #include<bits/stdc++.h>3#include<bits/stdc++.h>4
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    0
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0 using0#include<bits/stdc++.h>444

    using3using4

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    6
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9 using9namespace0 namespace1#include<bits/stdc++.h>44
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3namespace7 3 namespace9 std;0

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4std;4
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    7
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4std;8std;9

    using3

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    01 1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05

    using3

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    01
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Python3

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    13
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    14

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    16
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17 #include<bits/stdc++.h>4

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    20
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    21#include<bits/stdc++.h>4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    23

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    25
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    27
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    28
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    29

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    16
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    16
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    34
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    35

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    27
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    27
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    40
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    29

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    44
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    28 namespace0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    27
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    53

    std;8

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    55

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    57
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1 1
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    50

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    23

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    57
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    50

    C#

    using

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    69

    9

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    71

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3 3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    75
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    76
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    77
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    78

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    83

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    8

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    0
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    91

    using3

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    93
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    6
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    0

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3namespace7 3 namespace9
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    05

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    77
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    10
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    7
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4std;8std;9

    using3

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    17 1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05

    using3

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    17
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    PHP

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    29

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    30
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    76
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    32
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    50

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    36
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    37
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    38
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    32
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    43
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    44

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    0
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    48
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    49
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    48

    Các

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    43
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    69

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    32
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    37
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    7
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    75
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    76
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    32
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    78 1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    80 3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    83
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    75
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    87

    JavaScript

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    88

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    30
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    90

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    93

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    95

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    0
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    98

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    93
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    6
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    0

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    07
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    7
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    10 1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    80 3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    15

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    16

    Độ phức tạp về thời gian: O (logn), trong đó n là số đã cho.: O(logn), where n is the given number.

    Không gian phụ trợ: O (1), vì chúng ta không sử dụng bất kỳ không gian bổ sung nào. & NBSP;O(1), as we are not using any extra space. 

    Phương pháp 2: Kiểm tra số đã cho là chia hết cho 3 hoặc không bằng cách sử dụng toán tử phân chia modulo. Checking given number is divisible by 3 or not by using the modulo division operator “%”. 

    C++

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    17

    using namespace std;

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    0
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    3

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    25
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    25 ____10
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    28

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3std;8
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    31

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    35 1
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    35
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    9 7

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Java

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    54
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    55

    9

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    57

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    58namespace7 3 namespace9
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    62

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    58
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    25
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    67
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    68
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    8

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3std;8
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    72namespace0 namespace1#include<bits/stdc++.h>44
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    76

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    77
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    01 1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    77
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    01
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    58
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Python3

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    95
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    17
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    68

    Is

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    58
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    57
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1 1
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    50

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    23

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    58
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    57
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    1
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    50

    C#

    using

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    69

    namespace7 9 23

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    58 3 namespace7 namespace9 28

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    25 31

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3std;8 34

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    777____438 1
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    2

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    77 38
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    7

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3 52

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    58
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    1

    JavaScript

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    88

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4 58 59

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4std;8 34

    using3 64 1

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    50

    For example n = 1332
    Sum of digits = 1 + 3 + 3 + 2
                 = 9
    Since sum is divisible by 3,
    answer is Yes.
    4
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    05

    using3 64

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    08
    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    50

    Input  : n = 769452
    Output : Yes
    
    Input  : n = 123456758933312
    Output : No
    
    Input  : n = 3635883959606670431112222
    Output : Yes
    3
    Let us consider 1332, we can write it as
    1332 = 1*1000 + 3*100 + 3*10 + 2
    
    The proof is based on below observation:
    Remainder of 10i divided by 3 is 1
    So powers of 10 only result in value 1.
    
    Remainder of "1*1000 + 3*100 + 3*10 + 2"
    divided by 3 can be written as : 
    1*1 + 3*1 + 3*1 + 2 = 9
    The above expression is basically sum of
    all digits.
    
    Since 9 is divisible by 3, answer is yes.
    16

    Độ phức tạp về thời gian: O (1) vì nó đang thực hiện các hoạt động liên tục O(1) as it is doing constant operations

    Không gian phụ trợ: O (1): O(1)

    Bài viết này được đóng góp bởi Đan Mạch_raza. Nếu bạn thích GeekSforGeeks và muốn đóng góp, bạn cũng có thể viết một bài viết bằng Write.GeekSforGeek.org hoặc gửi bài viết của bạn. Xem bài viết của bạn xuất hiện trên trang chính của GeekSforGeek và giúp các chuyên viên máy tính khác. Xin vui lòng viết nhận xét nếu bạn tìm thấy bất cứ điều gì không chính xác hoặc bạn muốn chia sẻ thêm thông tin về chủ đề được thảo luận ở trên. & NBSP;DANISH_RAZA . If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.
    Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.