Pascal:
var n:integer;
f:boolean;
begin
f:=false;
repeat
write ('N = ');
readln (n);
until (n>=1000) and (n<=9999);<br> while (not f) and (n<>0) do
begin
if n mod 10 = 4 then f:=true;
n:=n div 10;
end;
if f then writeln ('YES') else writeln ('NO');
end.
C++:
#include
using namespace std;
int main()
{
int n;
bool f = false;
while (n<1000 || n>9999)
{
cout <<"N = ";<br> cin >>n;
}
while (!f && n!=0)
{
if (n%10==4)
f = true;
}
if (f)
cout <<"YES" <<endl;<br> else cout <<"NO" <<endl;<br> return 0;
}