przenosze tutaj ten temat.
Tworzę aplikację obiektową generującą liczby automorficzne od 0 do miliona.
Problem jest taki że program generuje mi tylko liczby 0,1,5,6, a powinien obliczac do miliona, tak jakby pętla zawężała się w jednej formułce **if ((a*a)mod 10)=a **
Madmike podpowiedział mi że mam problem z pętlami i continue, lecz nie za bardzo orientuję się co teraz postąpić
mój kod wygląda tak:
Procedure TForm1.Button1Click(Sender: TObject);
var
a,g,d:Integer;
begin
d:=StrToInt(Edit1.Text);
g:=StrToInt(Edit2.Text);
for a:=d to g do
if ((a*a) mod 10)=a then
Memo1.Lines.Add(inttostr(a));
if ((a*a) mod 100)=a then
Memo1.Lines.Add(inttostr(a));
if ((a*a) mod 1000)=a then
Memo1.Lines.Add(inttostr(a));
if ((a*a) mod 10000)=a then
Memo1.Lines.Add(inttostr(a));
if ((a*a) mod 100000)=a then
Memo1.Lines.Add(inttostr(a));
if ((a*a) mod 1000000)=a then
Memo1.Lines.Add(inttostr(a));
end;