I wrote this code for Sieve Of Eratosthenes but it is giving compile time error on ios_base::sync_with_stdio(false);.
The code is executing when I remove that line.
#include<bits/stdc++.h>
using namespace std;
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
void sieveOfEratosthenes(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p=2; n>=p*p; p++) {
    if (prime[p]) {
      for (int i = p*p; i<=n; i+=p)
        prime[i] = false;
    }
  }
  for(int p=2; p<=n; p++)
    cout <<p << " ";
}
int main() {
  cout << "Hello World!\n";
  int n;
  cout << "Please enter an integer n\n";
  cin >> n;
  sieveOfEratosthenes(n);
}
 
    