Hello everyone, i'm new to c++. I'm currently trying to make a program that finds the first prime above 1 billion, but i can't make it work. it just prints all numbers from 1 billon to infinity. This is my code:

I hope you can help me!Code:#include <iostream> #include <math.h> using namespace std; int prime(int n); int main () { int i; for (i = 100000000;; i++) { if (prime(i)) cout << "Dette er er det første primtal over 1 milliard: " << i << endl; break; } cin.get(); return 0; } int prime(int n) { int i; double sqrt_of_n = sqrt(n); for (i = 2; i <= sqrt_of_n; i++) { if (n % i == 0) return false; } return true; }