//C program to Check Prime Number using Simple Trial
//Division Approach
#include <stdio.h>
int isPrime(int N){
//Check divisibility from 2 to N-1
for(int i=2;i<N;i++){
//If N is divisible by i,it is not prime number
if(N % i == 0){
return 0;
}
}
//If no divisors were found,N is a prime number
return 1;
}
int main() {
int N=10;
printf("Is %d prime?\n",N);
//Check if the number is prime
if(isPrime(N)){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: