东方博宜 1176. 素数问题
东方博宜 1176. 素数问题
#include<iostream>
using namespace std;
int main()
{ int n ;while(cin >> n && n!=0) {int count_n ;count_n = 0 ;int k ;for( k = 1 ; k <= n ; k++){int count_k ;count_k = 0 ;int j ;for( j = 2 ; j < k ; j++){if (k % j != 0) count_k += 1 ;}if(count_k == k-2)count_n += 1 ;}cout << count_n << endl ;}
}