Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "ru");
- int x;
- cout << "Введите число от 1 до 100: ";
- cin >> x;
- if (x < 1 || x >= 100) {
- cout << "Некорректный ввод" << endl;
- }
- else {
- if (x >= 10 && x < 100) {
- int result = x / 10 + x % 10;
- cout << "Количество цифр - 2" << endl;
- cout << "Сумма цифр - " << result << endl;
- }
- else {
- cout << "Количество цифр - 1" << endl;
- cout << "Сумма цифр - " << x << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment