Program A1_8;
var
a,b,c,d,n:integer;
begin
readln(n);
a:=n mod 10;
b:=(n div 10) mod 10;
c:=(n div 100) mod 10;
d:=(n div 1000) mod 10;
if
(d<>0)and(c<>0)and(b<>0)and(a<>0)
and(n mod a=0) and (n mod b=0) and
(n mod c=0) and (n mod d=0)
then writeln('YES')
else writeln('NO');
readln;
end.
|
//Program A1.8
#include
<iostream>
using
namespace std;
int main()
{int
n,a,b,c,d;
cin>>n;
a=n%10;
b=(n/10)%10;
c=(n/100)%10;
d=(n/1000)%10;
if(a!=0 && b!=0 && c!=0
&& d!=0 &&
n%a==0 && n%b==0 &&
n%c==0 && n%d==0)
cout << "YES\n"
;
else cout<<"NO\n";
return 0;
}
|