U E D R , A S I H C RSS

소수구하기/영동

~cpp 
#include<iostream>
#include <ctime>
using namespace std;
int main()
{
	clock_t t1 = clock();//시간재기위한라인
	int i;
	int j;
	int count;
	for(i=2;i<50000;i++){
		count=0;
		for(j=2;j<i;j++){
			if(i%j==0)
			{
				count++;
				break;
			}
		}
		if(count==0)
			cout<<i<<"\n";
	}
	clock_t t = clock() - t1;//시간재기위한라인
	cout << (double)(t/CLOCKS_PER_SEC) << "\n";
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:14
Processing time 0.0091 sec