Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication27.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include "stdio.h"
- #include <iostream>
- #include <cmath>
- using namespace std;
- int sum(int a){
- int s=0;
- while (a != 0){
- s += a % 10;
- a /= 10;
- }
- return s;
- }
- int del3(int a){
- if (sum(a) % 3 == 0)
- return true;
- else return false;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- int n;
- cin >> n;
- if (del3(n))
- cout << "YES\n";
- else
- cout << "NO\n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement