Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void suma(int n, int &s) {
- s = 0;
- bool used[10] = {};
- while (n) {
- int dig = n % 10;
- if (dig % 2) {
- used[dig] = true;
- }
- n /= 10;
- }
- for (int i = 1; i < 10; i += 2) {
- if (used[i]) {
- s += i;
- }
- }
- }
- int main() {
- //call here
- return 0;
- }
Add Comment
Please, Sign In to add comment