===============
还要好好学习呀!
第十二楼老兄写的程序有个小毛病啊` 当我成排输入数字再运行程序就会陷入死循环```
7,8,9,[enter]
Output:
Error Input! Please try again!
Error Input! Please try again!
Error Input! Please try again!
Error Input! Please try again!
Error Input! Please try again!
Error Input! Please try again!
Error Input! Please try again! 并非故意找茶,想知道怎么样才能避免这个错误~~ 不吝赐教``
4到N的所有数,写得不好,不要见笑啊,而且可能有错,大家多提意见啊!!
#include <stdio.h>
void main()
{
int i,j,zj,g1,x,g2,n,flag;
scnaf("%d",&n);
for(i=4;i<=n;i++)
` { flag=1;
for(j=2;j<i-1;j++)
{
for(x=2;x<sqrt(j);x++)
if (!(j%x))
break;
if(x>sqrt(j))
{
g1=j;
g2=i-j;
flag=0;
}
}
if (flag==0)
{
for(x=2;x<sqrt(g2);x++)
{
if (!(g2%x))
break;
}
if (x>sqrt(g2))
printf("%d",i);
}
}
}