Advertisement
thedigletdistroyer

Untitled

Feb 5th, 2023
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std ;
  3. int main()
  4. {
  5.     int n,rest=0,raspuns=0;
  6.     cin >> n ;
  7.     raspuns = n % 3 ;
  8.     while (n != 0)
  9.     {
  10.  
  11.         if (n % 10 % 3 == raspuns)
  12.         {
  13.             rest ++ ;
  14.         }
  15.  
  16.         n=n/10 ;
  17.  
  18.     }
  19.  
  20.     cout << rest ;
  21.     return 0 ;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement