//Это можно стереть. Если в N есть 0 то тогда программа выведет NO. program z1; var b,c,d,i,s,l:integer; a:string; begin read(a); b:=length(a); s:=StrToInt(a); c:=0; for i:=1 to b do for i:=1 to b do begin d:=StrToInt(a[i]); if d=0 then l:=1; end; if l=0 then begin for i:=1 to b do for i:=1 to b do begin d:=StrToInt(a[i]); if (s mod d)=0 then c:=c+1; end; end else write('NO');if (l=0) and (c=b) then write('T'); if (l=0) and (c<>b) then write('P'); end.
Объяснение:
#include "pch.h"
#include <stdio.h>
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int num, k=0;
string str;
cout << "Введи многозначное число" << endl;
cin >> num;
while (num != 0)
{
k += 1;
num /= 10;
}
if(k==1)
{
cout << k << " цифра" << endl;
}
else if (k >= 2 && k <= 4) {
cout << k << " цифры" << endl;
}
else {
cout << k << " цифр" << endl;
}
system("pause");
return 0;
}