Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,S=0,c=0;
- cin>>n;
- int m=n;
- while(m)
- {
- S+=m%10;
- m/=10;
- }
- while(n)
- {
- if((S-n%10)%3==0)
- c++;
- n/=10;
- }
- cout<<c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement