2.
#include <iostream>
using namespace std;
int main()
{
int n, cnt = 0;
cin >> n;
while (n)
{
n /= 10;
cnt++;
}
cout << cnt;
return 0;
}
Varianta modificata
#include <iostream>
using namespace std;
int main()
{
int n, s = 0;
cin >> n;
while (n)
{
s += n % 10;
n /= 10;
}
cout << s;
return 0;
}
3.
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; ++i)
{
if (n % i == 0)
{
cout << i << " ";
}
}
return 0;
}
Varianta modificata
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 2; i < n; ++i)
{
if (n % i == 0)
{
cout << i << " ";
}
}
return 0;
}