Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int getDigitCountFromNumber(int n) {
- int count = 0;
- while (n > 0) {
- count++;
- n /= 10;
- }
- return count;
- }
- int main() {
- cout << "Suma cifrelor dintre 1234 si 222 este: " << getDigitCountFromNumber(1234) + getDigitCountFromNumber(222) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment