验证哥德巴赫猜想
作者:互联网
#include <stdio.h>
#include <math.h>
int prime_s(int x)
{
int i;
for(i=2;i<=sqrt(x);i++)
{
if(0==x%i)
{
return 0;
}
}
if(i>sqrt(x))
return 1;
}
int main()
{
int n,i;
int c=0;
again:
scanf("%d",&n);
if(n>6&&n<=1000000)
{
if(0==n%2)
{
for(i=1;i<(n/2);i++)
{
c=n-i;
if(prime_s(i)==1&&prime_s(c)==1)
{
printf("%d %d\n",i,c);
}
}
}
}
else
{
printf("请输入正确范围数字:");
goto again;
}
return 0;
}
标签:prime,again,main,return,验证,int,哥德巴赫猜想,include 来源: https://blog.csdn.net/qq_62995672/article/details/121363771