pascal - Delphi - Prime Numbers -


this question has answer here:

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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -