#include <iostream>

using namespace std;

int main(void)

{

cout << "Input the largest positive integer to check: ";

unsigned int maxN;

cin >> maxN;

unsigned int nPrimes =0;

for (int i = 2; i <=maxN; i =i + 1)

{

bool isPrime =true;

for (int j =2; j < i; j =j + 1)

{

if (i%j ==0) isPrime =false;

}

if (isPrime)

{ // cout << i << " "; //Use to check that you’re getting primes

nPrimes =nPrimes + 1;

}

}

cout << "\n\nThere are " << nPrimes << " prime numbers <=" << maxN << endl;

return 0;Code:#include <iostream>