Check it please prime no question

#include
using namespace std;

void PrintPrimes(int n){
    int i,no;
    for(i=2;no<=n;no=no+1){
    // check if no. is prime or not 
    for(i=2;i<no;i=i+1){
        if(no%i==0){
            break;
        }
    }
    if(i==no){
        cout<<no<<"";
    }
    }
}
int main(){
    int n;
    cin>>n;
    PrintPrimes(n);
    
    cout<<endl;
    PrintPrimes(n);
    return 0;

}

it is not running check it please

hi @manishayadav1360_c0939b9a17f994ff

 for(i=2;no<=n;no=no+1)

Instead of this make the correction–>

for(no=2;no<=n;no=no+1)

hi @manishayadav1360_c0939b9a17f994ff
I hope it’s clear now??

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.