Subiectul 3.
program varianta1_sub3_problema3;
var f :text;
m,x,n:longint;
a:array[1..100] of longint;
function divizibil(x,n:integer):boolean;
var i:integer;
ok:boolean;
begin
ok:=true; { Presupunem ca numarul este divizibil}
if x mod n <>0 then
ok:=false;
divizibil:=ok;
end;
begin
write ('n=');read (n);
m:=0; { Unde m este numarul de elemente divizibile cu 0}
if n<=999 then begin
assign (f,'bac1.txt');
reset(f);
while eof(f)=false do begin
read (f,x);
if divizibil(x,n)=true then begin
write (x,' ');
m:=m+1;
end;
end;
close (f);
end;
if m=0 then write('Nu exista');
end.
L.E.
Subiectul 4
program varianta1_subiectul4;
type vector= array[1..100] of integer;
var v:vector;
j, i,n,a:integer;
raspuns:string;
function sub(v:vector;a,n:integer):integer;
var s,i:integer;
begin
s:=0;
for i:=1 to n do
if v[i]
s:=s+1;
sub:=s;
end;
{punctul a] }
begin
write ('n=');read (n);
write ('a=');read (a);
for i:=1 to n do begin
write ('v[',i,']='); read (v[i]);
end;
write (sub(v,a,n));
{punctul a }
raspuns:='DA';
for i:=1 to n-1 do
for j:=i+1 to n do
if sub(v,v[i],n)=sub(v,v[j],n) then
raspuns:='NU';
writeln;
write (raspuns);
end.
Editat de DarkByte - Nu mai posta de mai multe ori consecutiv