Blame view

P61930_en/S001-AC.cc 375 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>

using namespace std;

int sum_digits(int n)
{
	if(!(n/10))
        {
                return n;
        }
	return n % 10 + sum_digits(n/10);
}

bool is_multiple_3(int n)
{
	if(!(n/10))
	{
		return (n == 3 | n == 6 | n == 9);
	}
	return is_multiple_3(sum_digits(n));
}

int main()
{
/*
	int a;
	cin >> a;
	cout << is_multiple_3(a) << endl;
	return 0;
*/
}