Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int sumaParnih(int nekiBroj) {
- if(nekiBroj==0)
- return 0;
- if((nekiBroj%10)%2 == 0)
- return (nekiBroj%10) + sumaParnih(nekiBroj/10);
- else
- return sumaParnih(nekiBroj/10);
- }
- int main() {
- int nekiBroj;
- cout << "Unesite neki visecifreni broj: ";
- cin >> nekiBroj;
- cout << "Suma parnih cifri unesenog broja je: " << sumaParnih(nekiBroj);
- system("pause>0");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement