bool isPrime(int num) {if(num <= 1) {return false;}for(int i = 2; i * i <= num; i++) {if(num % i == 0) {return false;}}return true;}
int main() {int n;std::cout << "Enter a number n: ";std::cin >> n;
}
bool isPrime(int num) {
if(num <= 1) {
return false;
}
for(int i = 2; i * i <= num; i++) {
if(num % i == 0) {
return false;
}
}
return true;
}
int main() {
std::cout << "Prime numbers from 1 to " << n << " are:" << std::endl;int n;
std::cout << "Enter a number n: ";
std::cin >> n;
for(int i = 1; i <= n; i++) {
if(isPrime(i)) {
std::cout << i << " ";
}
}
return 0;
}