#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int i, j, n, isPrime,max=0; int prime[100000]; int top=0; cin>>n; int a[n]; for(int i=0;i>a[i]; if(a[i]>max) { max=a[i]; } } for(i=2; i<=max; i++) { /* Assume that the current number is Prime */ isPrime = 1; /* Check if the current number i is prime or not */ for(j=2; j<=i/2; j++) { /* * If i is divisible by any number other than 1 and self * then it is not prime number */ if(i%j==0) { isPrime = 0; break; } } /* If the number is prime then print */ if(isPrime==1) { prime[top]=i; top++; } } for( i=0;i