Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- #include <random>
- #include <algorithm>
- using namespace std;
- int count(int n) {
- int count = -1, t_n = n, sum = 0;
- while (n != 0)
- {
- sum += n % 10;
- n /= 10;
- }
- while (t_n > 0)
- {
- count++;
- t_n -= sum;
- }
- return count;
- }
- int main() {
- int n;
- cin >> n;
- cout << "count = " << count(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment