pascal - Delphi - Prime Numbers -
this question has answer here:
- how check prime number in delphi 2 answers
a prime number (or prime) natural number greater 1 has no positive divisors other 1 , itself. i'm doing check if number prime or not :
begin writeln('give number '); readln(n); s := 0; := 1 n if n mod = 0 s := s + 1 ; if s = 2 writeln('prime') else writeln('not prime'); sleep(50000); end.
i'm trying prime numbers between 1 , 100 (or other number) using :
begin writeln('give number '); readln(n); := 1 n begin s := 0; j := 1 begin if mod j = 0 s := s +1 ; if s = 2 writeln(i); end; end; sleep(500000000000); end.
but it's not reallyworking .
i able fix :
begin writeln('give number '); readln(n); := 1 n begin s := 0; j := 1 begin if mod j = 0 s := s +1 ; end; if s = 2 writeln(i); end; sleep(50000); end.
Comments
Post a Comment