c語言judge
發布時間: 2023-02-26 13:33:25
① C語言函數判斷素數
#include<stdio.h>
#include<math.h>
intjugde(intx)
{
inti;
if(x<2)
return0;
for(i=2;i<=sqrt(x);++i)
if(x%i==0)
return0;
return1;
}
intmain()
{
inti;
for(i=101;i<1000;i+=2)
if(jugde(i)==1)
printf("%d",i);
return0;
}
熱點內容