Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int anz_gerade(int wert){
  8. while( wert>0 ){
  9. for(int n {wert%10}; wert%10 > 0; wert/=10){
  10.  
  11. int sum{0};
  12.  
  13. if(n%2 == 0)
  14. sum ++;
  15. else sum += 0;
  16. }
  17. return sum;
  18. }
  19.  
  20.  
  21. }
  22.  
  23.  
  24. int main (){
  25. int wert;
  26. cout << "Zahl: \n";
  27. cin >> wert;
  28.  
  29. anz_gerade(wert);
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement