當前位置:首頁 » 編程語言 » 絕對素數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;
}

運行結果:

熱點內容
php過濾非中文 發布:2025-09-17 00:02:13 瀏覽:517
來源碼 發布:2025-09-16 23:57:00 瀏覽:856
yeah郵箱的伺服器地址 發布:2025-09-16 23:36:52 瀏覽:701
c的引用java 發布:2025-09-16 23:36:48 瀏覽:307
的n次方編程 發布:2025-09-16 23:25:34 瀏覽:285
python安卓版 發布:2025-09-16 23:01:04 瀏覽:823
碼小易編程 發布:2025-09-16 23:00:56 瀏覽:335
在線音樂源碼 發布:2025-09-16 22:57:39 瀏覽:685
api開發php 發布:2025-09-16 22:06:15 瀏覽:602
mysql自動備份linux 發布:2025-09-16 21:58:33 瀏覽:949