Rhetos
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 9 Ω


Basic256 Programme Primzahlfinder


Quellcode


Basiswissen


Das untenstehende Programm kann direkt in Basic256 ausgeführt werden.

Quellcode


#Überprüfung ob p eine Primzahl ist
cls
print "Gib eine natürliche Zahl ein."

antwort$=" ist eine Primzahl."
input p
for teiler=2 to (p-1)
#Überprüfung, ob Rest der Division 0 ergibt (wäre keine Primzahl)
if p%teiler=0 then antwort$=" ist keine Primzahl."
next teiler
print p;
print antwort$