STANAANDREY

bacT9 sIII 1

May 25th, 2021 (edited)
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void suma(int n, int &s) {
  5.     s = 0;
  6.     bool used[10] = {};
  7.     while (n) {
  8.         int dig = n % 10;
  9.         if (dig % 2) {
  10.             used[dig] = true;
  11.         }
  12.         n /= 10;
  13.     }
  14.     for (int i = 1; i < 10; i += 2) {
  15.         if (used[i]) {
  16.             s += i;
  17.         }
  18.     }
  19. }
  20.  
  21. int main() {
  22.     //call here
  23.     return 0;
  24. }
  25.  
Add Comment
Please, Sign In to add comment