Solução do algoritimos q exibe numeros primos.
obs: as variaveis tem q ser inteiras pois entre um numero real e outro(tipo 1 e 2) há infinitos numeros fracionais. Program NumerosPrimos ; var a,b,i:integer; Begin
writeln('Entre com dois numeros um menor e um maior');
writeln('Exemplo: 1 e 100');
writeln('Caso o programa não exiba nada após, é porque não existe numeros primos no intervalo');
readln(a,b);
if ((a = 1) and (b >= 7)) thenbegin
writeln('1 é primo');
writeln('2 é primo');
writeln('3 é primo');
writeln('5 é primo');
writeln('7 é primo'); end; if ((a = 2) and (b >= 7)) thenbegin
writeln('2 é primo');
writeln('3 é primo');
writeln('5 é primo');
writeln('7 é primo'); end; if ((a = 3) and (b >= 7)) thenbegin
writeln('3 é primo');
writeln('5 é primo');
writeln('7 é primo'); end; if ((a = 5) and (b >= 7)) thenbegin
writeln('5 é primo');
writeln('7 é primo'); end; if ((a = 7) and (b >= 7)) thenbegin
writeln('7 é primo'); end; for i:=a to b do
if ((i mod 2 <>0) and (i mod 3 <>0)) and ((i mod 5 <>0) and (i mod 7 <>0)) and (i <>1) then writeln(i,' é primo'); End.