delphi 判断素数的简单例子


本文整理自网络,侵删。

 
一个判断素数的简单例子:
function IsPrime (N: Integer): Boolean;
var
    Test: Integer;
begin
    IsPrime := True;
    for Test := 2 to N - 1 do
      if (N mod Test) = 0 then
      begin
        IsPrime := False;
        break; {jump out of the for loop}
      end;
end;

相关阅读 >>

Delphi tidhttp抓取页面信息

Delphi xe tparallel.for循环

Delphi中用idhttp获取json数据乱码问题

Delphi button 实现下拉列表

Delphi中内嵌汇编

Delphi 2009 之 tcategorypanelgroup[1]: chevronalignment 等

Delphi 数字转换成中文

Delphi richedit 加入链接

Delphi adoquery filter使用

Delphi winsock 域名获取远程服务器ip

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...