Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int funkcija(int n, int suma){
  6. while (n / 10 != 0){
  7. if (n % 10 == 5 || n % 10 == 7 || n % 10 == 9){
  8. suma = suma + n % 10;
  9. }
  10. return funkcija(n / 10, suma);
  11. }
  12. if (n == 5 || n == 7 || n == 9) suma = suma + n;
  13. return suma;
  14. }
  15.  
  16. int main(){
  17. int n;
  18. int suma = 0;
  19. cout << "upisi broj: ";
  20. cin >> n;
  21. cout << "zbroj neparnih znamenki vecih od 3 je: " << funkcija(n, suma);
  22.  
  23.  
  24. system("pause");
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement