Pascal:
var n,m:longint;
f:boolean;
begin
write ('Decimal: ');
readln(n);
write ('Number: ');
readln (m);
f:=true;
while (n<>0) do
begin
if ((n mod 10)=m) then
begin
f:=true;
break;
end;
n:=n div 10;
end;
if f then writeln ('YES!') else writeln ('NO');
readln;
end.
C++:
#include
using namespace std;
int main()
{
int n,m;
bool f = false;
cout <<"Decimal: ";<br> cin >>n;
cout <<"Number: ";<br> cin >>m;
while (n!=0)
{
if ((n%10)==m)
{
f = true;
break;
}
n/=10;
}
if (f)
cout <<"YES!" <<endl;<br> else cout <<"NO!" <<endl;<br> return 0;
}