Start New Discussion within our Software Development Community

Prime or not?This little program will show prime numbers with green color from 0 to 100.By FlamingClaw;

Program Solution01;
Uses Crt;
Const Number = 100;
Var i:Word;{0..65535}

{checker function}
Function PrimeOrNot(pon00:word):String;
  Var
    pon01  :Word;
    Counter:Word;
  Begin
    Counter:=0;
    For pon01:=1 To pon00 Do
      Begin
        If (pon00 Mod pon01 = 0) Then
          Begin
            Counter:=Counter+1;
          End;{if}
      End;{for}
    If (Counter = 2) Then
      Begin
        TextColor(10);
        PrimeOrNot:=' Prime.';
      End
    Else Begin
          TextColor(15);
          PrimeOrNot:=' Not Prime.';
         End;{if}
  End;{function}

Begin {main}
   For i:=0 To Number Do
   WriteLn(i:3,PrimeOrNot(i));
   ReadLn;
End.

{
-= Note By FlamingClaw =-

All programs created by me  are written and tested
in Dev Pascal and/or Turbo Pascal 7.0

-= Created By FlamingClaw =-
-=2009.03.31=-
}
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.