#include <iostream>
#include <cmath>
usingnamespace std;
void is_prime(int x);
int main(){
int numb;
cout<<"\t\t\tPrime'ing Over a Billion!!!"<<endl<<endl;
cout<<"Enter a Number : ";
cin>>numb;
cout<<endl;
is_prime(numb)
;
}
void is_prime(int x){
for (x; true; x++){
for (int i; i < sqrt(x); i++){
if (x%i != 0){
cout<<"The next prime number from x is going to be "<<x<<endl;
break;}
}
}
}
Not in your code. This i: for (int i; i < sqrt(x); i++)
is some random integer value.1
1. I occasionally hear rumours that some compilers, in (bloated, slow) tricycle mode, will silently initialise values to zero that they really shouldn't. If that's the case, it's not doing you any favours.