Marian23

TEMA LA INFO 4

Oct 8th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int reduce(int a, int b){
  6. int s = 0;
  7. while(a){
  8.     if(a % 10 == 0)
  9.         a = a / 10;
  10.     if(b % (a % 10) != 0)
  11.         s = s + a % 10;
  12.     a = a / 10;
  13. }
  14. return s;
  15. }
  16.  
  17. int main()
  18. {
  19.    cout << reduce(2402804 , 8000);
  20.     return 0;
  21. }
Add Comment
Please, Sign In to add comment