Tin học VCT kiểm tra xem n có phải là snt hay ko 24/07/2021 By Charlie VCT kiểm tra xem n có phải là snt hay ko
uses crt;var n,i: integer; ok: boolean;beginclrscr;write (‘nhap n: ‘); readln (n);ok:=false;if (n=0) or (n=1) or (n=3) then ok:=falseelsebeginok:=true;for i:=3 to n-1 doif n mod i=0 then ok:=false;end;if ok=false then writeln (n,’ ko phai la so nguyen to’);if ok=true then writeln (n,’ la so nguyen to’);readln;end. Trả lời