#include <stdio.h>
#include <math.h>
#include <stdbool.h>
// Function to check if a number is prime
bool isPrime(int num) {
if (num <= 1) return false;
for (int i = 2; i <= sqrt(num); i++) {
if (num % i == 0) return false;
}
return true;
}
int main() {
int number = 1001; // Start checking from 1001
while (!isPrime(number)) {
number++; // Increment until a prime is found
}
printf("The smallest prime number greater than 1000 is: %d\n", number);
}
/*
run:
The smallest prime number greater than 1000 is: 1009
*/