#include <stdio.h>
main() {
int n, i;
printf("Enter a Number:\n");
scanf("%d", & n);
for (i = 2; i <= n / 2; i++) {
if (n % i == 0) {
break;
}
}
if (i > n / 2) {
printf("%d is a prime number", n);
} else
{
printf("%d is not a prime number", n);
}
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter a Number:
7
7 is a prime number