题解 | #KiKi求质数个数#

KiKi求质数个数

http://www.nowcoder.com/practice/d3a404ee0f8d41f98bf4707035d91086

#include <iostream>
using namespace std;

int main()
{
	int geshu=1; //因数个数
	int count = 0;//质数个数
	for (int i = 100; i < 1000; i++)
	{
		for (int j = 2; j <= i; j++)
		{
			if (i % j == 0)
				geshu++;
            if(geshu>2)
                break;

		}
		if (geshu == 2)
			count++;
		geshu = 1;
	}
	cout << count << endl;
}
全部评论

相关推荐

牛客nb666号:见天才的门槛罢了查看图片
点赞 评论 收藏
分享
12-19 15:04
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务