program Primo; var n, i: integer; esPrimo: boolean; begin writeln('Ingrese un número:'); readln(n); esPrimo := true; if n < 2 then esPrimo := false else for i := 2 to n div 2 do if n mod i = 0 then begin esPrimo := false; break; end; if esPrimo then writeln(n, ' es un número primo') else writeln(n, ' no es un número primo'); end.
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter