Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int anz_gerade(int wert) {
- int sum{ 0 };
- while(wert>0){
- int n = wert % 10;
- if (n % 2 == 0)
- sum++;
- else sum += 0;
- wert /= 10;
- }
- return sum;
- }
- int main() {
- int wert;
- cout << "Zahl: \n";
- while (cin >> wert)
- anz_gerade(wert);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement