Bài 2. TẬP SỐ NGUYÊN TỐ
Tìm tập b là các số nguyên tố từ 1 số nguyên dương N (1 { "@context": "https://schema.org", "@type": "QAPage", "mainEntity": { "@type": "Question", "name": " Bài 2. TẬP SỐ NGUYÊN TỐ Tìm tập b là các số nguyên tố từ 1 số nguyên dương N (1
0 bình luận về “Bài 2. TẬP SỐ NGUYÊN TỐ Tìm tập b là các số nguyên tố từ 1 số nguyên dương N (1<N<32767) và xuất kết quả tìm được ra file tap-snt.out - Dữ liệu vào: c”
uses crt; var n,i:integer; d:text; function nt(a:longint):boolean; var i:longint; begin i:=2; while a mod i<>0 do inc(i); nt:=i=a; end; begin clrscr; assign(d,’input.pas’);reset(d); readln(d,n); close(d); assign(d,’output.pas’);rewrite(d); for i:=2 to n do if nt(i) then writeln(d,i); close(d); end.
uses crt; var n,i:integer; d:text; function nt(a:longint):boolean; var i:longint; begin i:=2; while a mod i<>0 do inc(i); nt:=i=a; end; begin clrscr; assign(d,’input.pas’);reset(d); readln(d,n); close(d); assign(d,’output.pas’);rewrite(d); for i:=2 to n do if nt(i) then writeln(d,i); close(d); end.
uses crt;
var n,i:integer; d:text;
function nt(a:longint):boolean;
var i:longint;
begin
i:=2;
while a mod i<>0 do inc(i);
nt:=i=a;
end;
begin
clrscr;
assign(d,’input.pas’);reset(d);
readln(d,n);
close(d);
assign(d,’output.pas’);rewrite(d);
for i:=2 to n do if nt(i) then writeln(d,i);
close(d);
end.
uses crt;
var n,i:integer; d:text;
function nt(a:longint):boolean;
var i:longint;
begin
i:=2;
while a mod i<>0 do inc(i);
nt:=i=a;
end;
begin
clrscr;
assign(d,’input.pas’);reset(d);
readln(d,n);
close(d);
assign(d,’output.pas’);rewrite(d);
for i:=2 to n do if nt(i) then writeln(d,i);
close(d);
end.
cho mình tả lời hay nhì nha hihihi