Autor Beitrag
Fabian
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Sa 20.07.02 19:53 
Gibt es in Delphi eine Methode mit der ich überprüfen kann ob eine Zahl gerade ist ?
Currywurst
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 50

Win XP Pro
D3 Pro, D5 Std, D6 Pers
BeitragVerfasst: Sa 20.07.02 20:25 
Titel: nein
aber mit Odd() kannst du prüfen ob sie UNgerade ist :-)
Phraser
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Sa 20.07.02 20:39 
Titel: MOD
Indirekt ja:

Du musst überprüfen, ob die Zahl modulus 2 = 0 ist:

ausblenden Quelltext
1:
2:
3:
if Zahl mod 2 = 0
   then showmessage('Die Zahl ist gerade.')
   else showmessage('Die Zahl ist ungerade');


Allerdings weiß ich nicht, ob du das mit Methode meinst. Aber ein Lösungsweg ist das schon.
Currywurst
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 50

Win XP Pro
D3 Pro, D5 Std, D6 Pers
BeitragVerfasst: Sa 20.07.02 20:58 
na dann gehts auch noch mit
 if zahl and 1 = 0 then grade, das is glaube nen tuck schneller :-D