for(j=2;j<=8;j++)/*j is place of number*/
{ printf("\
%ld",sum);
if(j<=2)
s*=7;
else
s*=8;
sum+=s;}
printf("\
sum=%ld",sum);
}
==============================================================
【程序 84】
题目:一个偶数总能表示为两个素数之和。
1.程序分析:
2.程序源代码:
#include "stdio.h"
#include "math.h"
main()
{ int a,b,c,d;
scanf("%d",&a);
for(b=3;b<=a/2;b+=2)
{ for(c=2;c<=sqrt(b);c++)
if(b%c==0) break;
if(c>sqrt(b))
d=a-b;
else
break;
for(c=2;c<=sqrt(d);c++)
if(d%c==0) break;
if(c>sqrt(d))
printf("%d=%d+%d\
",a,b,d);
}
}
==============================================================
【程序 85】
题目:判断一个素数能被几个 9 整除
1.程序分析:
2.程序源代码:
main()
{ long int m9=9,sum=9;
int zi,n1=1,c9=1;
scanf("%d",&zi);
while(n1!=0)
{ if(!(sum%zi))
n1=0;