#include <iostream>
using namespace std;
//@Writer 5396952 Hyeonmin LEE
int main(){
bool arr[1000];
int count = 0;
for(int i = 0; i < 1000; i++)
{
arr[i] = true;
}
for(int i = 2; i < 1000; i++)
{
if (arr[i] == true)
{
for(int j = i + 1; j < 1000; j++)
{//loop checks if there is a number devidable by 2, and by the numbers after
if(j % i == 0)
{
arr[j] = false;
}
}
}
}
for(int i = 2; i < 1000; i++)
{
if(arr[i] == true)
{
count++;
cout << count << ". " << i << " is prime number" << endl;
}
}
return 0;
}
/*I'm thinking to use it for my JAVA assignment if it's possible^^
got to know that JAVA doesn't have unsigned int.. java is weird
*/
using namespace std;
//@Writer 5396952 Hyeonmin LEE
int main(){
bool arr[1000];
int count = 0;
for(int i = 0; i < 1000; i++)
{
arr[i] = true;
}
for(int i = 2; i < 1000; i++)
{
if (arr[i] == true)
{
for(int j = i + 1; j < 1000; j++)
{//loop checks if there is a number devidable by 2, and by the numbers after
if(j % i == 0)
{
arr[j] = false;
}
}
}
}
for(int i = 2; i < 1000; i++)
{
if(arr[i] == true)
{
count++;
cout << count << ". " << i << " is prime number" << endl;
}
}
return 0;
}
/*I'm thinking to use it for my JAVA assignment if it's possible^^
got to know that JAVA doesn't have unsigned int.. java is weird
*/
댓글
댓글 쓰기