#include <bits/stdc++.h>
using namespace std;
void SieveOfEratosthenes(int num)
{
    bool pno[num + 1];
    memset(pno, true, sizeof(pno));
    for (int i = 2; i* i < = num; i++)
    {
        if (pno[i] == true)
        {
            for (int j = i * 2; j < = num; j + = i)
                pno[j] = false;
        }
    }
    for (int i = 2; i < = num; i++)
        if (pno[i])
            cout << i << " ";
}
int main()
{
    int num = 15;
    cout << "The prime numbers smaller or equal to " << num << " are: ";
    SieveOfEratosthenes(num);
    return 0;
}
the error is in the for loop. According to me the code is correct.
 
     
     
    