SHARE
TWEET

Untitled

a guest Nov 14th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,S=0,c=0;
  8.     cin>>n;
  9.     int m=n;
  10.     while(m)
  11.     {
  12.         S+=m%10;
  13.         m/=10;
  14.     }
  15.     while(n)
  16.     {
  17.         if((S-n%10)%3==0)
  18.             c++;
  19.         n/=10;
  20.     }
  21.     cout<<c;
  22.     return 0;
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top