Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(0, "");
- int n, m;
- cout << "Введите число N: ";
- cin >> n;
- cout << "Введите число M: ";
- cin >> m;
- int i;
- for (i = n; i <= m; ++i) {
- int number = i, count = 0, sum = 0;
- while (number > 0) {
- sum += number % 10;
- ++count;
- number /= 10;
- }
- cout << "Количество цифр в числе " << i << " равно " << count << endl;
- cout << "Сумма цифр в числе " << i << " равна " << sum << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement