"Vytvorte program,ktory najde vsetky prirodzene cisla mensie ako N, ktore su delitelne kazdou svojou cifrou."
Ak by sa to niekomu podarilo, tak dopredu vdaka
Kód: Vybrať všetko
readln(N);
for i:=1 to N do begin
cislo:=i;
pom:=true;
while (cislo>0) and (pom=true) do begin
cifra:= cislo mod 10;
if (cislo mod cifra) <> 0 then pom:=false;
cislo:= cislo div 10;
end;
if (pom=true) writeln(i);
end;
Kód: Vybrať všetko
readln(N);
for i:=1 to N do begin
cislo:=i;
pom:=true;
while (cislo>0) do begin
cifra:= cislo mod 10;
if (cifra = 0) begin
pom:=false;
break;
end;
if (i mod cifra) <> 0 then begin
pom:=false;
break;
end;
cislo:= cislo div 10;
end;
if (pom=true) writeln(i);
end;