Answer explained
Write a C++ program to display prime numbers from 1 to 51.
```cpp
#include <iostream>
using namespace std;
int main() {
for (int n = 2; n <= 51; ++n) {
bool prime = true;
for (int d = 2; d * d <= n; ++d) {
if (n % d == 0) { prime = false; break; }
}
if (prime) cout << n << ' ';
}
return 0;
}
```
Output: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47. One is not prime; testing divisors only through √n is sufficient.