當前位置:首頁 » 編程語言 » 絕對素數c語言

絕對素數c語言

發布時間: 2025-03-13 19:48:16

Ⅰ 用c語言設計程序找出10-200內的絕對素數

#include"stdio.h"
intprime(intn){//素數判斷
inti;
if(!(n&1))
return0;
for(i=3;i*i<=n;i+=2)
if(!(n%i))
return0;
return1;
}
intmain(intargc,char*argv[]){
intn,t,m;
for(n=11;n<200;n+=2){
for(m=n%10,t=n/10;t;m=m*10+t%10,t/=10);
if(prime(n)&&prime(m))
printf("%3d<-->%3d ",n,m);
}
return0;
}

運行結果:

熱點內容
scratch少兒編程課程 發布:2025-04-16 17:11:44 瀏覽:639
榮耀x10從哪裡設置密碼 發布:2025-04-16 17:11:43 瀏覽:368
java從入門到精通視頻 發布:2025-04-16 17:11:43 瀏覽:84
php微信介面教程 發布:2025-04-16 17:07:30 瀏覽:310
android實現陰影 發布:2025-04-16 16:50:08 瀏覽:793
粉筆直播課緩存 發布:2025-04-16 16:31:21 瀏覽:344
機頂盒都有什麼配置 發布:2025-04-16 16:24:37 瀏覽:212
編寫手游反編譯都需要學習什麼 發布:2025-04-16 16:19:36 瀏覽:812
proteus編譯文件位置 發布:2025-04-16 16:18:44 瀏覽:366
土壓縮的本質 發布:2025-04-16 16:13:21 瀏覽:592