Autor Beitrag
Cookie007
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 96

win2000 / Xp / Linux9.3
Delphi7
BeitragVerfasst: Di 17.10.06 15:59 
Hallo Leute,

Hab folgendes Problem:
Ich möchte ein Programm schreiben welches die Teiler einer zahl ausfindig macht
hier mein Quelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
X:= StrToInt(edit1.text);
  y := 0;
  repeat
  Y+1;
  E := X mod Y;
  if E = 0 then
  T := X div Y;
  edit2.text := edit2.Text + IntToStr(T);
  until X < Y


Die Variablen sind vereinbart,
mein problem ist Y+1 er sagt :
statement expected but expression of integer found
THX im Vorraus
Cookie007

_________________
Mein System : A64 2400 Clawhammer, 1534 MB Ram, 200GB Festplatte, GeForce 6600 (Gigabyte)
Warum so ein langes Gesicht auf jede Frage gibt es eine Antwort, du musst sie nur suchen.(suchfunktion)
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 17.10.06 16:02 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
X:= StrToInt(edit1.text);
  y := 0;
  repeat
  Y := Y+1;
  E := X mod Y;
  if E = 0 then
  T := X div Y;
  edit2.text := edit2.Text + IntToStr(T);
  until X < Y

_________________
We are, we were and will not be.
binco
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Di 17.10.06 18:48 
ausblenden Alternativ geht auch:
1:
2:
3:
4:
5:
6:
7:
8:
9:
X:= StrToInt(edit1.text);
y := 0;
repeat
  inc(Y);
  E := X mod Y;
  if E = 0 then
  T := X div Y;
  edit2.text := edit2.Text + IntToStr(T);
until X < Y
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 17.10.06 18:52 
Was ist der Teiler einer Zahl? Jede Zahl ist Teiler von irgendeiner anderen Zahl.
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Di 17.10.06 19:25 
Deshalb schreibt er ja die Teiler. Alle Zahlen n, für die gilt: x/n ist eine natürliche Zahl, sind Teiler von x.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell