Beruflich Dokumente
Kultur Dokumente
i:char;
y,n:longint;
err:integer;
begin
write ('n=');
readln (n);
nr:='';
str (n,S);
for i:='9' downto '0' do
if pos (i,S)<>0 then
nr:=nr+i;
val (nr,y,err);
writeln ('Numarul este: ',y);
end.
2) var d,n:integer;
sw,sw1:byte;
begin
write ('n=');
readln (n);
sw:=0;
while (n>0) and (sw=0) do
begin
sw1:=0;
for d:=2 to n div 2 do
if n mod d = 0 then
sw1:=1;
if sw1=1 then
sw:=1;
n:=n div 10;
if sw=0 then
writeln ('superprim')
else
writeln ('0');
end;
end.
3) var p,nr,uc:word;
n:longint;
begin
write ('n=');
readln (n);
nr:=0;
p:=1;
repeat
uc:=n mod 10;
n:=n div 10;
if uc mod 2 = 1 then
begin
nr:=uc*p + nr;
p:=p*10;
end;
until n=0;
writeln (nr);
end.
4) var i,j,n,d:word;
sw:byte;
begin
write ('n=');
readln (n);
i:=1;
repeat
inc(i);
sw:=0;
for d:=2 to i div 2 do
if i mod d=0 then
sw:=1;
if sw=0 then
if sqr(i)<=n then
write(sqr(i),' ');
until sqr(i)>n;
end.
5) var n:integer;
i,x,h,ogl:word;
begin
write ('n=');
readln (n);
i:=n;
repeat
inc(i);
ogl:=0;
x:=i;
repeat
h:=x mod 10;
ogl:=ogl*10 + h;
x:=x div 10;
until x=0;
until ogl=i;
writeln (i);
end.
6) var p,x,k:word;
n:integer;
begin
write ('n=');
readln (n);
write ('k=');
readln (k);
p:=1;
x:=n;
repeat
p:=p*10;
x:=x div 10;
until x<10;
while (k>0) and (n>0) do
begin
n:=n mod p;
p:=p div 10;
dec(k);
end;
if n=0 then
writeln ('vid')
else
writeln (n);
end.
7) var n:integer;
sw,sw1,i,j:byte;
x,S:word;
begin
write ('n=');
readln (n);
sw:=0;
for i:=1 to n do
begin
write ('x=');
readln (x);
S:=1+x;
for j:=2 to x div 2 do
if x mod j = 0 then
S:=S+j;
sw1:=0;
for j:=2 to S div 2 do
if S mod j = 0 then
sw1:=1;
if sw1=0 then
begin
write (x);
sw:=1;
end;
end;
if sw=0 then
write ('niciun numar');
end.
8) var i,n,sw:byte;
x:word;
d,S:longint;
begin
write ('n=');
readln (n);
S:=0;
d:=2;
sw:=0;
for i:=1 to n do
begin
write ('x=');
readln (x);
S:=S+x;
end;
repeat
if S mod d=0 then
begin
sw:=1;
d:=d+1;
end;
until (sw=1) or (d=S div 2);
if sw=0 then
write ('da')
else
writeln ('nu');
end.
9) var S,x:word;
n,i:byte;
begin
write ('n=');
readln (n);
S:=0;
for i:=1 to n do
begin
write ('x=');
readln (x);
S:=(S + x mod 10) mod 10;
end;
write ('S=');
writeln (S);
end.
begin
write ('n=');
readln (n);
S:=0;
max:=-maxint;
sw:=0;
for i:=1 to n do
begin
readln (V[i]);
if V[i]>=0 then
begin
inc(S,V[i]);
sw:=1;
end
else
if V[i]>max then
max:=V[i];
end;
if sw=1 then
write (S)
else
write (max);
end.
begin
writeln ('n=');
readln (n);
write ('m=');
readln (m);
min:=maxint;
for i:=1 to m do
begin
write ('B[',i,']=');
readln (B[i]);
if min>B[i] then
min:=B[i];
end;
cont:=0;
for i:=1 to n do
begin
write ('A[',i,']=');
readln (A[i]);
if A[i]<min then
inc(cont);
end;
write (cont);
end.
begin
write ('n=');
readln (n);
nr:=1;
x:=n;
while x>9 do
begin
inc(nr);
x:=x div 10;
end;
p:=1;
for i:=1 to nr div 2 do
p:=p*10;
s:=n mod p;
if nr mod 2 = 0 then
f:=n div p
else
begin
f:=n div p;
mij:=f mod 10;
f:=f div 10;
sol:=(s*10+mij)*p+f;
end;
if nr mod 2 = 0 then
sol:=s*p + f;
writeln (sol);
readln;
end.
begin
write ('n=');
readln (n);
for i:=1 to n do
begin
write ('V[',i,']=');
readln (V[i]);
end;
repeat
sw:=0;
for i:=1 to n-2 do
begin
if i mod 2=1 then
if V[i]<V[i+2] then
begin
aux:=V[i+2];
V[i+2]:=V[i];
V[i]:=aux;
sw:=1;
end;
if i mod 2 = 0 then
if V[i]>V[i+2] then
begin
aux:=V[i+2];
V[i+2]:=V[i];
V[i]:=aux;
sw:=1;
end;
end;
until sw=0;
for i:=1 to n do
writeln (V[i]);
end.
begin
write ('n=');
readln (n);
for i:=1 to n do
for j:=1 to n do
A[i,j]:=2;
for i:=1 to n do
begin
A[i,i]:=1;
A[i,n-i+1]:=1;
end;
for i:=1 to n do
begin
for j:=1 to n do
write (A[i,j],'');
writeln;
end;
end.
begin
write ('n=');
readln (n);
k:=0;
for i:=1 to n do
for j:=1 to n do
readln (V[i,j]);
for i:=1 to n do
for j:=1 to n do
begin
if k=0 then
begin
inc(k);
A[k]:=V[i,j];
B[i]:=1;
end
else
sw:=0;
for t:=1 to k do
if A[t]=V[i,j] then
begin
inc(B[t]);
sw:=1;
end;
if sw=0 then
begin
inc(k);
A[k]:=V[i,j];
B[k]:=1;
end;
end;
sw:=B[1];
for i:=2 to k do
if B[i]>max then
max:=B[i];
for i:=1 to k do
if B[i]=max then
writeln (A[i],' ');
end.
begin
write ('n=');
readln (n);
for i:=1 to n do
readln (V[i]);
sw:=0;
for i:=1 to n do
for j:=i+1 to n do
if V[i]=V[j] then
sw:=1;
if sw=1 then
writeln ('NU')
else
writeln ('DA');
end.
begin
write ('m=');
readln (m);
write ('n=');
readln (n);
for i:=1 to m do
for j:=1 to n do
begin
write ('A[',i,',',j,']=');
readln (A[i,j]);
end;
max:=0;
for i:=1 to m do
begin
min:=A[i,1];
for j:=1 to n do
if A[i,j]<min then
min:=A[i,j];
write (min,' ');
if max<min then
max:=min;
end;
writeln ('max= ',max);
end.
begin
assign (f,'f1.in');
reset (f);
readln (f,n);
for i:=1 to n do
begin
for j:=1 to n do
begin
read(f,A[i,j]);
write(A[i,j],' ');
end;
readln(f);
writeln;
end;
cont:=0;
cont1:=0;
for i:=1 to n-1 do
for j:=i+1 to n do
if (sqrt(A[i,j]) = trunc(sqrt(A[i,j]))) then
inc(cont);
for i:=2 to n do
for j:=1 to i-1 do
begin
sw:=0;
k:=2;
while (k<=sqrt(A[i,j])) do
begin
if (A[i,j] mod k = 0) then
sw:=1;
inc(k);
end;
if sw=0 then
inc(cont1);
end;
writeln (cont,' ',cont1);
close(f);
end.
begin
write ('n=');
readln (n);
for i:=1 to n do
for j:=1 to n do
A[i,j]:=2;
for i:=1 to n do
begin
A[i,i]:=0;
A[i,n-i+1]:=0;
end;
for i:=1 to n div 2 do
for j:=i+1 to n-i do
begin
A[i,j]:=1;
A[n-i+1,j]:=1;
end;
for i:=1 to n do
begin
for j:=1 to n do
write (A[i,j],' ');
writeln;
end;
end.