Untitled
gdunknown
plain_text
2 years ago
555 B
5
Indexable
#include <iostream>
using namespace std;
int main()
{
int a;
int b = 0; // количество цифр
int c = 0; // сумма цифр
cin >> a;
int d = a;
int sum = a;
while (a != 0) {
a /= 10;
b += 1;
}
while (sum != 0) {
c += sum % 10;
sum /= 10;
}
cout << b << endl;
cout << c << endl;
if (d < 100) {
cout << d % 10;
d /= 10;
cout << d % 10;
d /= 10;
}
else {
for (int i = 0; i <= b - 2; i += 1) {
cout << d % 10;
d /= 10;
}
cout << d % 10;
}
}
//жесткоEditor is loading...