Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 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. int sum{ 0 };
  9.  
  10. while(wert>0){
  11.  
  12. int n = wert % 10;
  13. if (n % 2 == 0)
  14. sum++;
  15. else sum += 0;
  16.  
  17. wert /= 10;
  18. }
  19. return sum;
  20.  
  21.  
  22.  
  23. }
  24.  
  25.  
  26. int main() {
  27. int wert;
  28. cout << "Zahl: \n";
  29. while (cin >> wert)
  30.  
  31. anz_gerade(wert);
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement