验证100以内的正偶数都能分解为两个素数之和
#include <stdio.h> int ss(int i) { int j; if(i <= 1) return 0; if(i == 2) return 1; for(j=2;j<i;j++) { if(i%j == 0) return 0; } return 1; } int main(void) { int i,j,temp,result; int ss_arr[100]; for(i=1;i<100;++i) { result = ss(i); if(result == 1) { ss_arr[i] = 1; } else { ss_arr[i] = 0; } } for(i=2;i<100;i=i+2) { for(j=1;j<100;j++) { if(ss_arr[j] != 1) continue; if(j >= i) continue; temp = i - j; if(ss_arr[temp] != 1) continue; printf("%d = %d + %d \n",i,j,temp); break; } } return 0; }